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

The publishIssues step fails with a NullPointerException if there is only one element in the issues parameter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • warnings-ng-plugin
    • None

      I haven't done any extensive testing but observed the following behavior:

       

      The following code:

      def pylint = scanForIssues tool: pyLint(pattern: 'pylint.log')
      publishIssues issues: [pylint] 

       

      Results in this exception:

      [Pipeline] End of Pipeline
      Also:   org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: cf76397c-7627-4e78-b036-e194e293c99d
      java.lang.NullPointerException
          at edu.hm.hafner.analysis.Report.addAll(Report.java:329)
          at io.jenkins.plugins.analysis.core.model.AnalysisResult.getIssues(AnalysisResult.java:417)
          at java.base/java.util.Optional.map(Optional.java:265)
          at io.jenkins.plugins.analysis.core.model.AnalysisHistory.getIssues(AnalysisHistory.java:142)
          at io.jenkins.plugins.analysis.core.model.DeltaReport.<init>(DeltaReport.java:48)
          at io.jenkins.plugins.analysis.core.steps.IssuesPublisher.attachAction(IssuesPublisher.java:100)
          at io.jenkins.plugins.analysis.core.steps.PublishIssuesStep$Execution.run(PublishIssuesStep.java:895)
          at io.jenkins.plugins.analysis.core.steps.PublishIssuesStep$Execution.run(PublishIssuesStep.java:842)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:829) 

       

      While this works: 

      def pylint = scanForIssues tool: pyLint(pattern: 'pylint.log')
      publishIssues issues: [pylint, pylint] 

       


       

      I was able to avoid this issue by switching to recordIssues: 

      recordIssues tool: pyLint(pattern: 'pylint.log') 

       

      But AFAIK the first code example should work as well, right?
       

      A relevant part of the code could be https://github.com/jenkinsci/warnings-ng-plugin/blob/v10.2.0/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/PublishIssuesStep.java#L872-L885.

       
      Note: Tested with version 10.2.0 of the "Warnings Next Generation" plugin.

            drulli Ulli Hafner
            primeos Michael Weiss
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: