[ 
https://issues.jenkins-ci.org/browse/JENKINS-12414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

bap closed JENKINS-12414.
-------------------------

    
> NullPointerException when running Conditional step (single) with Run 
> Condition set to "Current build status" in an empty project
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JENKINS-12414
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-12414
>             Project: Jenkins
>          Issue Type: Bug
>          Components: run-condition
>    Affects Versions: current
>         Environment: Windows; 
> running java -jar jenkins.war
>            Reporter: Eric Borts
>            Assignee: bap
>         Attachments: config.xml, jenkins_null_result_stacktrace.txt
>
>
> My project is a free-form project with several windows batch command steps 
> followed by a conditional build step which copies a .zip file to a network 
> drive. The conditional build step checks the current status of the build and, 
> if successful, performs the copy (essentially conditional artifact deploy as 
> a build step). The conditional step is set to FAIL the build if the 
> conditional step fails (and it *does* fail). 
> The best I can deduce from looking through the run-condition and jenkins code 
> (for the first time) is that the result of the build is returning null, but I 
> couldn't determine the cause. 
> I whittled down my build to a very simple test case. No source control, all 
> options unchecked. Step 1 is a windows batch call to "echo hello > 
> _hello.txt" followed by a conditional step. The conditional step checks for a 
> Successful build status, and then copies "echo world > world.txt". This code 
> is never reached because the null pointer exception is thrown.
> The exception is also thrown if the only step in the project is the 
> conditional check. 
> I assume that the freestyle project returns by default a NULL for the status 
> of the build, and that a successful windows batch file step also does not set 
> the build status to a non-NULL value. setting "exit 1" in the batch file 
> stops the build, so clearly the status is being set on failure and not on 
> success. I tried returning "exit 0" from the batch command but still observed 
> the NullPointerException
> Attached is the exception stack trace (also pasted below) and the config.xml 
> file for the project.
> --------------------------------
> Jan 13, 2012 5:39:30 PM org.jenkins_ci.plugins.run_condition.BuildStepRunner 
> logEvaluateException
> WARNING: Exception caught evaluating condition: 
> [java.lang.NullPointerException: null], action = [Fail the build]
> java.lang.NullPointerException
>         at hudson.model.Result.isWorseOrEqualTo(Result.java:107)
>         at 
> org.jenkins_ci.plugins.run_condition.core.StatusCondition.runPerform(StatusCondition.java:71)
>         at 
> org.jenkins_ci.plugins.run_condition.BuildStepRunner$2.evaluate(BuildStepRunner.java:107)
>         at 
> org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail.conditionalRun(BuildStepRunner.java:147)
>         at 
> org.jenkins_ci.plugins.run_condition.BuildStepRunner.perform(BuildStepRunner.java:105)
>         at 
> org.jenkinsci.plugins.conditionalbuildstep.singlestep.SingleConditionalBuilder.perform(SingleConditionalBuilder.java:104)
>         at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
>         at 
> hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:697)
>         at hudson.model.Build$RunnerImpl.build(Build.java:178)
>         at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
>         at 
> hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:467)
>         at hudson.model.Run.run(Run.java:1404)
>         at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
>         at hudson.model.ResourceController.execute(ResourceController.java:88)
>         at hudson.model.Executor.run(Executor.java:238)
> Jan 13, 2012 5:39:30 PM hudson.model.Run run
> INFO: FOSS_SL #67 main build action completed: FAILURE

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to