jenkinsci / cucumber-reports-plugin

Jenkins plugin to generate cucumber-jvm reports
https://plugins.jenkins.io/cucumber-reports/
GNU Lesser General Public License v2.1
210 stars 232 forks source link

NPE at net.masterthought.jenkins.CucumberReportPublisher.generateReport(CucumberReportPublisher.java:133) #119

Closed ostov closed 7 years ago

ostov commented 7 years ago

Jenkins ver. 2.46 Cucumber reports 3.5.0


[CucumberReport] Copied 4 json files from workspace "/home/jenkins/workspace/mercury/target" to reports directory "/home/jenkins/jenkins_home/jobs/mercury/builds/124/cucumber-html-reports/.cache"
[CucumberReport] Filtered out 1 json files:
[CucumberReport] /home/jenkins/jenkins_home/jobs/mercury/builds/124/cucumber-html-reports/.cache/cucumber.json
ERROR: Build step failed with exception
java.lang.NullPointerException
    at net.masterthought.jenkins.CucumberReportPublisher.generateReport(CucumberReportPublisher.java:133)
    at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:86)
    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1067)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
    at hudson.model.Run.execute(Run.java:1753)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:405)```
ostov commented 7 years ago

~~I have managed to resolve this issue by changing Report Path from "target" to "target/" But this is odd.~~ Update: this does not helped - NPE happens sporadically.

choppedpork commented 7 years ago

Having a similar (the same?) issue since upgrading to 3.5.0 - in a traditional Maven project I've not got the Report Path set at all, the error is:

java.lang.NullPointerException
    at net.masterthought.jenkins.CucumberReportPublisher.generateReport(CucumberReportPublisher.java:133)
    at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:86)
    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1067)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
    at hudson.model.Run.execute(Run.java:1753)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:405)

After downgrading to 3.4.0 the build passes and results are correctly published.

~From a pipeline build I'm getting a very similar NPE (not identical though). Weirdly enough the error is not in the Jenkins job log but inside of the cucumber report! screenshot from 2017-02-14 20-16-49~

edit: clarification + crossed out pipeline stacktrace as it turned out to be unrelated to the version change.

damianszczepanik commented 7 years ago

Show me JSON file

rkettelerij commented 7 years ago

We're experiencing the same issue:

12:02:27 ERROR: Build step failed with exception
12:02:27 java.lang.NullPointerException
12:02:27    at net.masterthought.jenkins.CucumberReportPublisher.generateReport(CucumberReportPublisher.java:133)
12:02:27    at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:86)
12:02:27    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
12:02:27    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
12:02:27    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
12:02:27    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
12:02:27    at hudson.model.Build$BuildExecution.post2(Build.java:185)
12:02:27    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
12:02:27    at hudson.model.Run.execute(Run.java:1753)
12:02:27    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
12:02:27    at hudson.model.ResourceController.execute(ResourceController.java:98)
12:02:27    at hudson.model.Executor.run(Executor.java:404)

Downgrading from 3.5 to 3.4 solved the issue.

damianszczepanik commented 7 years ago

OK, i'm not sure why it happens but I know how to fix it. Will be in next release.

In the meantime the workaround is to just edit job configuration and save it again - then it will probably save empty collection, not null reference

damianszczepanik commented 7 years ago

Released