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

NPE can be thrown on null triggers list

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: workflow-job-plugin
    • Labels:
    • Environment:
    • Similar Issues:

      Description

      Seen in some logs:

      2017-12-21 19:00:38.734+0000 [id=38]	WARNING	c.c.h.p.folder.AbstractFolder#loadChildren: could not load /tech/appl/default/jenkins/jobs/SDF_Dev/jobs/GroovyTest/jobs/Build_NewCode/jobs/Maven-POC
      java.lang.NullPointerException
      	at org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty.stopTriggers(PipelineTriggersJobProperty.java:96)
      	at org.jenkinsci.plugins.workflow.job.WorkflowJob.removeProperty(WorkflowJob.java:580)
      	at hudson.model.Job.removeProperty(Job.java:535)
      	at org.jenkinsci.plugins.workflow.job.WorkflowJob.setTriggers(WorkflowJob.java:540)
      	at org.jenkinsci.plugins.workflow.job.WorkflowJob.onLoad(WorkflowJob.java:152)
      	at com.cloudbees.hudson.plugins.folder.AbstractFolder.loadChildren(AbstractFolder.java:617)
      	at com.cloudbees.hudson.plugins.folder.AbstractFolder.onLoad(AbstractFolder.java:722)
      	at com.cloudbees.hudson.plugins.folder.Folder.onLoad(Folder.java:104)
      	at com.cloudbees.hudson.plugins.folder.AbstractFolder.loadChildren(AbstractFolder.java:617)
      	at com.cloudbees.hudson.plugins.folder.AbstractFolder.onLoad(AbstractFolder.java:722)
      	at com.cloudbees.hudson.plugins.folder.Folder.onLoad(Folder.java:104)
      	at com.cloudbees.hudson.plugins.folder.AbstractFolder.loadChildren(AbstractFolder.java:617)
      	at com.cloudbees.hudson.plugins.folder.AbstractFolder.onLoad(AbstractFolder.java:722)
      	at com.cloudbees.hudson.plugins.folder.Folder.onLoad(Folder.java:104)
      	at hudson.model.Items.load(Items.java:372)
      	at jenkins.model.Jenkins$17.run(Jenkins.java:3099)
      	at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
      	at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
      	at jenkins.model.Jenkins$7.runTask(Jenkins.java:1073)
      	at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
      	at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

      It seems like the `triggers` attribute can be null in some circomstances, hence iterating on it triggers this NPE. Maybe some code called the setTriggers() method with a null parameter. So I think we should add some defensive checks like already done in the constructor to avoid this.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                batmat Baptiste Mathus
                Reporter:
                batmat Baptiste Mathus
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: