[JIRA] (JENKINS-40297) Clover-Plugin NullPointer exception on build when <failingTarget> config is missing

0 views
Skip to first unread message

atyaf66@gmail.com (JIRA)

unread,
Dec 7, 2016, 7:05:01 PM12/7/16
to jenkinsc...@googlegroups.com
Ahmed Musallam created an issue
 
Jenkins / Bug JENKINS-40297
Clover-Plugin NullPointer exception on build when <failingTarget> config is missing
Issue Type: Bug Bug
Assignee: Stephen Connolly
Components: clover-plugin
Created: 2016/Dec/08 12:04 AM
Priority: Major Major
Reporter: Ahmed Musallam

Clover Plugin throws an NPE on build.. find exception below. Our team was able to debug the issue and it was due to missing <failingTarget> config for clover publisher because the failing target fields were not populated. As you can see, this error is not helpful and it would be nice if the log can be more helpful in case of a missing config.

The NPE happens exactly at this line in CloverPublisher.java
Set<CoverageMetric> failingMetrics = failingTarget.getFailingMetrics(result);
where failingTarget is null.. well because it was not provided in the xml config.

Disclaimer: I have not developed jenkins plugins before so I appologize if I'm not using correct terms.

ERROR: Build step failed with exception
java.lang.NullPointerException
at hudson.plugins.clover.CloverPublisher.processCloverXml(CloverPublisher.java:250)
at hudson.plugins.clover.CloverPublisher.performImpl(CloverPublisher.java:202)
at hudson.plugins.clover.CloverPublisher.perform(CloverPublisher.java:160)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:764)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:724)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1047)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
at hudson.model.Run.execute(Run.java:1769)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

serajam@gmail.com (JIRA)

unread,
Dec 15, 2016, 5:41:01 AM12/15/16
to jenkinsc...@googlegroups.com
Fedor Petryk commented on Bug JENKINS-40297
 
Re: Clover-Plugin NullPointer exception on build when <failingTarget> config is missing

Same here.
The report is publishing but build status is setting to failure.

bjreppen@gmail.com (JIRA)

unread,
Dec 15, 2016, 2:28:06 PM12/15/16
to jenkinsc...@googlegroups.com

Same exception here. Wrapping it in a try/catch block as a workaround.

bjreppen@gmail.com (JIRA)

unread,
Dec 15, 2016, 2:28:08 PM12/15/16
to jenkinsc...@googlegroups.com
Bjørn Reppen edited a comment on Bug JENKINS-40297
Same exception here.  Wrapping it in a try/catch block as a temporary workaround works .

atyaf66@gmail.com (JIRA)

unread,
Dec 15, 2016, 2:35:02 PM12/15/16
to jenkinsc...@googlegroups.com

Bjørn Reppen NullPointerExceptions are meant to be fixed, not caught. The underlying problem is that failingTarget is NULL and that is what needs to be fixed with a default value OR at least a Log message to remind the user to add those failingTarget values.

mparfianowicz@atlassian.com (JIRA)

unread,
Jan 16, 2017, 4:43:02 AM1/16/17
to jenkinsc...@googlegroups.com

Can you confirm that this still happens in the latest Jenkins Clover Plugin - version 4.7.1?

I'm asking because in this version I fixed NPE and closed two other tickets: JENKINS-38956 and JENKINS-39410 which look very similar to yours.

I suspect that this bug report can be closed too.

atyaf66@gmail.com (JIRA)

unread,
Jan 16, 2017, 11:24:02 AM1/16/17
to jenkinsc...@googlegroups.com

Marek Parfianowicz looking at the code, it seems the issue was fixed! and that NPE will not happen. Thanks!
As to testing it on a Jenkins instance, please give me some time to run a local instance and install 4.7.1. Or if anyone wants to confirm, use the follwing config:
<publishers>
<hudson.plugins.clover.CloverPublisher plugin="clo...@4.7.0">
<cloverReportDir>target/site/clover</cloverReportDir>
<cloverReportFileName>clover.xml</cloverReportFileName>
<healthyTarget>
<methodCoverage>70</methodCoverage>
<conditionalCoverage>80</conditionalCoverage>
<statementCoverage>80</statementCoverage>
</healthyTarget>
</hudson.plugins.clover.CloverPublisher>
</publishers>

Reply all
Reply to author
Forward
0 new messages