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

NewIssueStep is not null safe when there is no description.

XMLWordPrintable

      When trying to create a JIRA ticket when there is no description filled out, a null pointer is thrown as follows:

      java.lang.NullPointerException
      	at org.thoughtslive.jenkins.plugins.jira.steps.NewIssueStep$Execution.run(NewIssueStep.java:76)
      	at org.thoughtslive.jenkins.plugins.jira.steps.NewIssueStep$Execution.run(NewIssueStep.java:56)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
      	at hudson.security.ACL.impersonate(ACL.java:260)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	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:748)

       

      Looking at the code it looks like this is caused by the toString method against a null object:

       

      @Override
      protected ResponseData<Object> run() throws Exception {
          ResponseData<Object> response = verifyInput();
          if (response == null) {
              logger.println("JIRA: Site - " + siteName + " - Creating new issue: "               + step.getIssue());
              final String description = step.isAuditLog()
              ?         addPanelMeta(step.getIssue().getFields().get("description").toString())
             : step.getIssue().getFields().get("description").toString();
              step.getIssue().getFields().put("description", description);
              response = jiraService.createIssue(step.getIssue());
          }
      return logResponse(response);
      }

       

       

       

            nrayapati Naresh Rayapati
            dom2497 Dominic Martino
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: