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

Build Pipeline and Copy Artifact plugin combination causes NPE

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      A classic case where two plugins work together to cause an error.

      On the left hand we have the PipelineBuild plugin. This plugin calls currentBuild.getEnvironment(null) to obtain certain data. This on itself does not actually break something, but I can't imagine calling that method with null is right.
      On the right hand we have the CopyArtifact plugin. This plugin introduces a new EnvironmentContributingAction ("EnvAction") which does not expect a null pointer to be passed.

      The method mentioned above walks through a list of EnvironmentContributingAction objects, and calls their buildEnvVars method. However, because the currentBuild.getEnvironment method is called with null, it cannot resolve an EnvVars object and falls back to null. That nullpointer is supplied to the CopyArtifact "EnvAction" action which tries to do things with the nullpointer. Obviously that action is causing an error.

      Links:

      Stacktrace:

      WARNING: Caught exception evaluating: from.getBuildPipelineForm(). Reason: java.lang.NullPointerException
      java.lang.NullPointerException
              at java.util.TreeMap.putAll(TreeMap.java:290)
              at hudson.plugins.copyartifact.CopyArtifact$EnvAction.buildEnvVars(CopyArtifact.java:359)
              at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:756)
              at au.com.centrumsystems.hudson.plugin.buildpipeline.PipelineBuild.getBuildResultURL(PipelineBuild.java:190)
              at au.com.centrumsystems.hudson.plugin.buildpipeline.BuildForm.<init>(BuildForm.java:66)
              at au.com.centrumsystems.hudson.plugin.buildpipeline.BuildForm.<init>(BuildForm.java:82)
              at au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView.getBuildPipelineForm(BuildPipelineView.java:214)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.apache.commons.jexl.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:258)
              at org.apache.commons.jexl.parser.ASTMethod.execute(ASTMethod.java:104)
              at org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
              at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
              at org.apache.commons.jexl.parser.ASTReferenceExpression.value(ASTReferenceExpression.java:51)
              at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:80)
              at hudson.ExpressionFactory2$JexlExpression.evaluate(ExpressionFactory2.java:72)
              at org.apache.commons.jelly.tags.core.CoreTagLibrary$3.run(CoreTagLibrary.java:134)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
              at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:63)
              at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:146)
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:270)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:98)
              at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:270)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
              at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:119)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:98)
              at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:270)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
              at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:119)
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
              at org.kohsuke.stapler.jelly.CompressTag.doTag(CompressTag.java:44)
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:270)
              at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:63)
              at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:63)
      

        Attachments

          Issue Links

            Activity

            Hide
            martijnb Martijn Baay added a comment -

            Marked Major instead of Minor as at least one of the plugins is quite popuplar

            Show
            martijnb Martijn Baay added a comment - Marked Major instead of Minor as at least one of the plugins is quite popuplar

              People

              • Assignee:
                Unassigned
                Reporter:
                martijnb Martijn Baay
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: