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

recordIssues and ScanForIssues in Pipeline get NPE Errors

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • warnings-ng-plugin
    • None
    • Jenkins Version - 2.150.1 LTS
    • warnings-ng 1.0.1

      Hello!

      When i use Android Lint or PMD in Declarative Pipeline, i get NPE.
      Freestyle Job working fine with Android Lint and PMD.

      This is my part of Pipeline: 

      recordIssues(
          enabledForFailure: true, 
          tools: [
              androidLint(pattern: '**/lint-results*.xml'), 
              checkStyle(pattern: '**/checkstyle*.xml'), 
              findBugs(pattern: '**/findbugs*.xml', useRankAsPriority: true) 
              pmd(pattern: '**/pmd*.xml')
          ]
      )
      

      This is received error:

      java.lang.NullPointerException
          at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.record(IssuesRecorder.java:621)
          at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.perform(IssuesRecorder.java:597)
          at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
          at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
          at hudson.security.ACL.impersonate(ACL.java:290)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
          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:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
      

      Actually, when i used scanForIssues, I've got another problem:

      java.lang.NullPointerException
          at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:160)
          at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:126)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
          at hudson.security.ACL.impersonate(ACL.java:290)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
          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:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
      

      Thank You!

          [JENKINS-55328] recordIssues and ScanForIssues in Pipeline get NPE Errors

          Alexander Yarosenko created issue -
          Alexander Yarosenko made changes -
          Priority Original: Blocker [ 1 ] New: Major [ 3 ]
          Alexander Yarosenko made changes -
          Description Original: Hello!

          When i use Android Lint or PMD in Declarative Pipeline, i get NPE.
          Freestyle Job working fine with Android Lint and PMD.

          This is my part of Pipeline:

           
          {code:java}
          recordIssues(
              enabledForFailure: true,
              tools: [
                  androidLint(pattern: '**/lint-results*.xml'),
                  checkStyle(pattern: '**/checkstyle*.xml'),
                  findBugs(pattern: '**/findbugs*.xml', useRankAsPriority: true)
                  pmd(pattern: '**/pmd*.xml')
              ]
          )
          {code}
          This is received error:

           
          {code:java}
          java.lang.NullPointerException
              at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.record(IssuesRecorder.java:621)
              at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.perform(IssuesRecorder.java:597)
              at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
              at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
              at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
              at hudson.security.ACL.impersonate(ACL.java:290)
              at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
              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:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
          {code}
          Actually, when i used scanForIssues, I've got another problem:
          {code:java}
          java.lang.NullPointerException
              at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:160)
              at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:126)
              at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
              at hudson.security.ACL.impersonate(ACL.java:290)
              at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
              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:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
          {code}
          Thank You!
          New: Hello!

          When i use Android Lint or PMD in Declarative Pipeline, i get NPE.
           Freestyle Job working fine with Android Lint and PMD.

          This is my part of Pipeline: 
          {code:java}
          recordIssues(
              enabledForFailure: true,
              tools: [
                  androidLint(pattern: '**/lint-results*.xml'),
                  checkStyle(pattern: '**/checkstyle*.xml'),
                  findBugs(pattern: '**/findbugs*.xml', useRankAsPriority: true)
                  pmd(pattern: '**/pmd*.xml')
              ]
          )
          {code}
          This is received error:
          {code:java}
          java.lang.NullPointerException
              at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.record(IssuesRecorder.java:621)
              at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.perform(IssuesRecorder.java:597)
              at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
              at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
              at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
              at hudson.security.ACL.impersonate(ACL.java:290)
              at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
              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:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
          {code}
          Actually, when i used scanForIssues, I've got another problem:
          {code:java}
          java.lang.NullPointerException
              at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:160)
              at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:126)
              at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
              at hudson.security.ACL.impersonate(ACL.java:290)
              at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
              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:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
          {code}
          Thank You!

          Sylvain G. added a comment -

          Fo my case, PMD header file cannot contains namespace. (namespace in project, excepts spring, are not permitted in my working envirnomnent.

          Header looks like this 

          <?xml version="1.0" encoding="UTF-8"?>
          <pmd version="5.4.1" timestamp="2018-12-25T12:09:50.888">
          <file ......
          </pmd>
          
          

          Thanks

           

          Sylvain G. added a comment - Fo my case, PMD header file cannot contains namespace. (namespace in project, excepts spring, are not permitted in my working envirnomnent. Header looks like this  <?xml version= "1.0" encoding= "UTF-8" ?> <pmd version= "5.4.1" timestamp= "2018-12-25T12:09:50.888" > <file ...... </pmd> Thanks  
          Ulli Hafner made changes -
          Link New: This issue relates to JENKINS-53181 [ JENKINS-53181 ]

          Ulli Hafner added a comment - - edited

          I added a meaningful exception if the symbol pmd is used and the PMD plugin is installed as well.

          Ulli Hafner added a comment - - edited I added a meaningful exception if the symbol pmd is used and the PMD plugin is installed as well.
          Ulli Hafner made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]
          Ulli Hafner made changes -
          Released As New: 1.0.1
          Status Original: Fixed but Unreleased [ 10203 ] New: Resolved [ 5 ]
          Ulli Hafner made changes -
          Released As Original: 1.0.1 New: warnings-ng 1.0.1

          douglas knudsen added a comment - - edited

          I see this as resolved, but I'm getting this error with no PMD in use at all.   I have ALL PMD checks, old PMD plugin, and new recordIssues removed from my declarative Jekinsfile and see this right after the recordIssues step using androidLint is firing.  I do have all the old analysis plugins installed on Jenkins as well as the new WarningsNG plugin, I have to migrate, eh?  If this is not related to this change, I can cut a new issue.  I am using WarningsNG 1.0.1

           

          The step for recording AndroidLint report is the below and the report is generated in Jenkins too.

          recordIssues enabledForFailure: true, tools: [androidLint(pattern: 'Rewards/build/reports/lint-results*.xml')]

           
          Post stage
          [Pipeline] androidLint
          [android-lint] Collecting Android Lint files...
          [android-lint] Searching for all files in /Users/Shared/Jenkins/Home/jobs/mobileheros_multibranch/branches/feature-poc-.ujsndh.c-warnignsng/workspace that match the pattern Rewards/build/reports/lint-results*.xml
          [android-lint] Parsing 1 file in /Users/Shared/Jenkins/Home/jobs/mobileheros_multibranch/branches/feature-poc-.ujsndh.c-warnignsng/workspace
          [android-lint] Successfully parsed file /Users/Shared/Jenkins/Home/jobs/mobileheros_multibranch/branches/feature-poc-.ujsndh.c-warnignsng/workspace/Rewards/build/reports/lint-results-playStoreMockDebug.xml with 2 unique warnings and 0 duplicates.
          [Pipeline] recordIssues
          Error when executing always post condition:
          java.lang.IllegalArgumentException: No valid tool defined! You probably used the symbol 'pmd' in your tool definition. This symbol is also used in the PMD plugin. In this case you must use the symbol 'pmdParser' instead, see JENKINS-55328. The symbol 'pmd' can be used only if the PMD plugin is not installed.
          at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.ensureThatToolIsValid(IssuesRecorder.java:251)
          at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.record(IssuesRecorder.java:634)
          at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.perform(IssuesRecorder.java:619)
          at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
          at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
          at hudson.security.ACL.impersonate(ACL.java:290)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
          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:745)

          [Pipeline] }

           

           

          UPDATED - I found through isolation that this is thrown from the androidLint tool in the recordIssues step

          recordIssues enabledForFailure: true, tools: [androidLint(pattern: 'Rewards/build/reports/lint-results*.xml')]

          douglas knudsen added a comment - - edited I see this as resolved, but I'm getting this error with no PMD in use at all.   I have ALL PMD checks, old PMD plugin, and new recordIssues removed from my declarative Jekinsfile and see this right after the recordIssues step using androidLint is firing.  I do have all the old analysis plugins installed on Jenkins as well as the new WarningsNG plugin, I have to migrate, eh?  If this is not related to this change, I can cut a new issue.  I am using WarningsNG 1.0.1   The step for recording AndroidLint report is the below and the report is generated in Jenkins too. recordIssues enabledForFailure: true, tools: [androidLint(pattern: 'Rewards/build/reports/lint-results*.xml')]   Post stage [Pipeline] androidLint [android-lint] Collecting Android Lint files... [android-lint] Searching for all files in /Users/Shared/Jenkins/Home/jobs/mobileheros_multibranch/branches/feature-poc-.ujsndh.c-warnignsng/workspace that match the pattern Rewards/build/reports/lint-results*.xml [android-lint] Parsing 1 file in /Users/Shared/Jenkins/Home/jobs/mobileheros_multibranch/branches/feature-poc-.ujsndh.c-warnignsng/workspace [android-lint] Successfully parsed file /Users/Shared/Jenkins/Home/jobs/mobileheros_multibranch/branches/feature-poc-.ujsndh.c-warnignsng/workspace/Rewards/build/reports/lint-results-playStoreMockDebug.xml with 2 unique warnings and 0 duplicates. [Pipeline] recordIssues Error when executing always post condition: java.lang.IllegalArgumentException: No valid tool defined! You probably used the symbol 'pmd' in your tool definition. This symbol is also used in the PMD plugin. In this case you must use the symbol 'pmdParser' instead, see JENKINS-55328 . The symbol 'pmd' can be used only if the PMD plugin is not installed. at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.ensureThatToolIsValid(IssuesRecorder.java:251) at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.record(IssuesRecorder.java:634) at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.perform(IssuesRecorder.java:619) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48) 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:745) [Pipeline] }     UPDATED - I found through isolation that this is thrown from the androidLint tool in the recordIssues step recordIssues enabledForFailure: true, tools: [androidLint(pattern: 'Rewards/build/reports/lint-results*.xml')]

            drulli Ulli Hafner
            zava2012 Alexander Yarosenko
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: