• Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • None
    • Groovy-Postbuild-Plugin-Version: 1.7
      Jenkins-Version: 1.470
      Machine: Windows XP SP02

      We use the Groovy-Postbuild-Plugin to set successful Upstream-Builds to failed, when a downstream-Build failes.
      The upstream-Build saves several Artefacts and creates Fingerprints from these.
      Some times the Groovy-Postbuild-Plugin works with the code below for ten or more builds, afterwards we get the below mentioned NullPointerException several times without changing anything in the configuration.

      ________________________________________________________
      Groovy-Code:
      upstreamBuilds = manager.build.getUpstreamBuilds();
      upstreamJob = upstreamBuilds.keySet().iterator().next();
      lastUpstreamBuild = upstreamJob.getLastBuild();
      if(lastUpstreamBuild.getResult().isBetterThan(manager.build.result)) {
      lastUpstreamBuild.setResult(manager.build.result);
      }

      ________________________________________________________
      Exception:
      Groovy script failed:
      java.lang.NullPointerException: Cannot invoke method isBetterThan() on null object
      at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77)
      at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:32)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
      at Script1.run(Script1.groovy:23)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
      at org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.perform(GroovyPostbuildRecorder.java:273)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:717)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:692)
      at hudson.model.Build$BuildExecution.post2(Build.java:183)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:639)
      at hudson.model.Run.execute(Run.java:1485)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:239)

            wolfs Stefan Wolf
            chmoser Christoph Moser
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: