ava.lang.NullPointerException: Cannot get property 'result' on null object

Jenkins JIRA | Gautham Rathina kumar | 9 months ago
  1. 0

    I am using the build flow project for combining the two different project test results.Then i am in need to change the build status of the aggregated test results so i am using groovy postbuild to change my build status.In that script if any one of the test fails gets failed in any of the projects then i am trying to change the build status to unstable.For that i am calculating the fail counts from both results using groovy script.But when i am trying this it throws the NULL pointer Exception. The script i used in the groovy postbuild is def testResult = manager.build.testResultAction.result def fail = testResult.failCount if(fail==NULL) { manager.buildSuccess() } else { manager.buildUnstable() } It throws the exception as ava.lang.NullPointerException: Cannot get property 'result' on null object at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:56) at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:156) at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227) at Script1.run(Script1.groovy:1) 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.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:166) at org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.perform(GroovyPostbuildRecorder.java:362) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668) at hudson.model.Run.execute(Run.java:1763) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410)

    Jenkins JIRA | 9 months ago | Gautham Rathina kumar
    ava.lang.NullPointerException: Cannot get property 'result' on null object
  2. 0

    I am using the build flow project for combining the two different project test results.Then i am in need to change the build status of the aggregated test results so i am using groovy postbuild to change my build status.In that script if any one of the test fails gets failed in any of the projects then i am trying to change the build status to unstable.For that i am calculating the fail counts from both results using groovy script.But when i am trying this it throws the NULL pointer Exception. The script i used in the groovy postbuild is def testResult = manager.build.testResultAction.result def fail = testResult.failCount if(fail==NULL) { manager.buildSuccess() } else { manager.buildUnstable() } It throws the exception as ava.lang.NullPointerException: Cannot get property 'result' on null object at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:56) at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:156) at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227) at Script1.run(Script1.groovy:1) 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.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:166) at org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.perform(GroovyPostbuildRecorder.java:362) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668) at hudson.model.Run.execute(Run.java:1763) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410)

    Jenkins JIRA | 9 months ago | Gautham Rathina kumar
    ava.lang.NullPointerException: Cannot get property 'result' on null object
  3. 0

    NULL pointer Exception in Groovy postbuild Script

    Stack Overflow | 9 months ago | gautham
    ava.lang.NullPointerException: Cannot get property 'result' on null object
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [JIRA] [build-flow-plugin] (JENKINS-33235) post groovy script throws Null Exception

    Google Groups | 9 months ago | gauthamrathinakumar@gmail.com (JIRA)
    ava.lang.NullPointerException: Cannot get property 'result' on null object
  6. 0

    [groovy-user] Accessing Domain-Object Property

    Google Groups | 9 years ago | Lorenz Graf
    ava.lang.NullPointerException: Cannot invoke method size() on null object

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. ava.lang.NullPointerException

      Cannot get property 'result' on null object

      at org.codehaus.groovy.runtime.NullObject.getProperty()
    2. Groovy
      AbstractCallSite.callGetProperty
      1. org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:56)
      2. org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:156)
      3. org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44)
      4. org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
      4 frames
    3. Unknown
      Script1.run
      1. Script1.run(Script1.groovy:1)
      1 frame
    4. Groovy
      GroovyShell.evaluate
      1. groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
      2. groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
      3. groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
      3 frames
    5. org.jenkinsci.plugins
      SecureGroovyScript.evaluate
      1. org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:166)
      1 frame
    6. org.jvnet.hudson
      GroovyPostbuildRecorder.perform
      1. org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.perform(GroovyPostbuildRecorder.java:362)
      1 frame
    7. Hudson
      Executor.run
      1. hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      2. hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
      3. hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
      4. hudson.model.Build$BuildExecution.post2(Build.java:185)
      5. hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
      6. hudson.model.Run.execute(Run.java:1763)
      7. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      8. hudson.model.ResourceController.execute(ResourceController.java:98)
      9. hudson.model.Executor.run(Executor.java:410)
      9 frames