-
Bug
-
Resolution: Won't Fix
-
Minor
-
Jenkins: 2.150.3
warnings-ng-plugin: 3.0.3
gradle: 5.2.1
java: 1.8
In my pipeline I have this syntax. checkstyleScan is null if the build completes successfully.
def checkstyleScan def errorProneScan try{ // gradle build }catch (e) { // checkstyle checkstyleScan = scanForIssues enabledForFailure: true, failedTotalHigh: 0, failedTotalNormal: 0, tools: [checkStyle(pattern: '**/reports/checkstyle/*.xml', reportEncoding: 'UTF-8')] throw e }finally{ parallel ( test: { //Junit junitPlatformTest junit allowEmptyResults: true, testResults: '**/reports/junit/*.xml' }, errorprone: { // error prone errorProneScan = scanForIssues enabledForFailure: true, failedTotalHigh: 0, tool: errorProne(reportEncoding: 'UTF-8') } ) publishIssues issues: [checkstyleScan, errorProneScan] }
I have other similar cases, I do not scan for every tool if I don't have to. But when I try to aggregate the results, I get a NPE.
java.lang.NullPointerException at io.jenkins.plugins.analysis.core.steps.PublishIssuesStep$Execution.run(PublishIssuesStep.java:507) at io.jenkins.plugins.analysis.core.steps.PublishIssuesStep$Execution.run(PublishIssuesStep.java:452) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) 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)
Is there a workaround to prevent this without lots of if statements to check if scans are completed? Maybe it's possible to skip null results in PublishIssuesStep or maybe I can use another syntax to achieve this. Thanks