Status: Closed (View Workflow)
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
Same exception here. Wrapping it in a try/catch block as a temporary workaround works.
bjornr 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.
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.
mparfianowicz 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:
CloverPublisher since 9.12.2016 has:
final Set<CoverageMetric> failingMetrics = failingTarget != null ? failingTarget.getFailingMetrics(result) : Collections.<CoverageMetric>emptySet()
Fixed in Jenkins Clover Plugin 4.7.1+ and 4.8.0+
The report is publishing but build status is setting to failure.