Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-25732

NPE Thrown when using the parameterize build with a 'Run Parameter'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: perforce-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.565.3
      OS: Ubuntu 12.04 LTS (x68)
      Perforce Server: 14.1
    • Similar Issues:

      Description

      After updating to 1.3.29, we noticed that when we have jobs with the 'Run Parameter', the Perforce plug-in throws a NPE when trying to calculate the effective workspace name.

      The stack trace printed out by Jenkins is a:

      [sample-run-parameter-job] $ p4 workspace -o sample-run-parameter-job
      Caught exception in perforce-plugin. nulljava.lang.NullPointerException
      at java.lang.String.replace(String.java:2219)
      at hudson.plugins.perforce.utils.MacroStringHelper.substituteParametersNoCheck(MacroStringHelper.java:185)
      at hudson.plugins.perforce.utils.MacroStringHelper.getDefaultSubstitutions(MacroStringHelper.java:341)
      at hudson.plugins.perforce.utils.MacroStringHelper.substituteParametersNoCheck(MacroStringHelper.java:246)
      at hudson.plugins.perforce.utils.MacroStringHelper.substituteParametersNoCheck(MacroStringHelper.java:298)
      at hudson.plugins.perforce.utils.MacroStringHelper.substituteParameters(MacroStringHelper.java:148)
      at hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:876)
      at hudson.model.AbstractProject.checkout(AbstractProject.java:1252)
      at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:615)
      at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
      at hudson.model.Run.execute(Run.java:1706)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:232)
      ERROR: Caught exception in perfoce-plugin. null

        Attachments

          Issue Links

            Activity

            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            The method getsEnvVars, where key or value is null.
            I suppose it is an issue in Run Parameter, but it makes sense to protect Perforce plugin from it

            Show
            oleg_nenashev Oleg Nenashev added a comment - The method getsEnvVars, where key or value is null. I suppose it is an issue in Run Parameter, but it makes sense to protect Perforce plugin from it
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Created https://github.com/jenkinsci/perforce-plugin/pull/62
            Mike Delaney, I'm not sure which plugin injects such environment variable

            Show
            oleg_nenashev Oleg Nenashev added a comment - Created https://github.com/jenkinsci/perforce-plugin/pull/62 Mike Delaney , I'm not sure which plugin injects such environment variable
            Hide
            mdelaney Mike Delaney added a comment -

            I completely agree. This seems more like a bug in the 'Run Parameter' plugin but thought the plug-in should offer some type of protection. I'm working on drafting up a bug for the Run Parameter plug-in but like you, I'm not sure where this gets injected so I'm researching that.

            The value for this variable eventually gets set but just after the SCM phase has already passed.

            Show
            mdelaney Mike Delaney added a comment - I completely agree. This seems more like a bug in the 'Run Parameter' plugin but thought the plug-in should offer some type of protection. I'm working on drafting up a bug for the Run Parameter plug-in but like you, I'm not sure where this gets injected so I'm researching that. The value for this variable eventually gets set but just after the SCM phase has already passed.
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            1.3.31 should resolve the issue.
            // SCM Link bot seems to be dead

            Show
            oleg_nenashev Oleg Nenashev added a comment - 1.3.31 should resolve the issue. // SCM Link bot seems to be dead
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            src/main/java/hudson/plugins/perforce/utils/MacroStringHelper.java
            src/test/java/com/synopsys/arc/jenkinsci/plugins/perforce/MacroStringHelperTest.java
            http://jenkins-ci.org/commit/perforce-plugin/45392c63b3f5bdc299503d94f84319ac4e27e493
            Log:
            [FIXED JENKINS-25732] - Don't fail with NPE if an environment variable contains null value

            Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/hudson/plugins/perforce/utils/MacroStringHelper.java src/test/java/com/synopsys/arc/jenkinsci/plugins/perforce/MacroStringHelperTest.java http://jenkins-ci.org/commit/perforce-plugin/45392c63b3f5bdc299503d94f84319ac4e27e493 Log: [FIXED JENKINS-25732] - Don't fail with NPE if an environment variable contains null value Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            src/main/java/hudson/plugins/perforce/utils/MacroStringHelper.java
            src/test/java/com/synopsys/arc/jenkinsci/plugins/perforce/MacroStringHelperTest.java
            http://jenkins-ci.org/commit/perforce-plugin/80360f0fc47477349f13c6f3482a348e1146af14
            Log:
            Merge pull request #62 from synopsys-arc-oss/JENKINS-25732

            [FIXED JENKINS-25732] - Don't fail with NPE if an environment variable has null value

            Compare: https://github.com/jenkinsci/perforce-plugin/compare/b3c84d1f4db2...80360f0fc474

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/hudson/plugins/perforce/utils/MacroStringHelper.java src/test/java/com/synopsys/arc/jenkinsci/plugins/perforce/MacroStringHelperTest.java http://jenkins-ci.org/commit/perforce-plugin/80360f0fc47477349f13c6f3482a348e1146af14 Log: Merge pull request #62 from synopsys-arc-oss/ JENKINS-25732 [FIXED JENKINS-25732] - Don't fail with NPE if an environment variable has null value Compare: https://github.com/jenkinsci/perforce-plugin/compare/b3c84d1f4db2...80360f0fc474

              People

              • Assignee:
                oleg_nenashev Oleg Nenashev
                Reporter:
                mdelaney Mike Delaney
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: