diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-01-13 18:27:20 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-01-13 18:27:20 +0100 |
commit | fdd1f0e14f339241a60f866f1c2f03a72c1c8c10 (patch) | |
tree | 486e79b4657e6f8e277a03e3a635c4cfe5cb97eb /plugins/sonar-core-plugin | |
parent | 3040801fd59a736e3f046632d60a9839adca8095 (diff) | |
download | sonarqube-fdd1f0e14f339241a60f866f1c2f03a72c1c8c10.tar.gz sonarqube-fdd1f0e14f339241a60f866f1c2f03a72c1c8c10.zip |
SONAR-3012 fix NPE
Diffstat (limited to 'plugins/sonar-core-plugin')
-rw-r--r-- | plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecorator.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecorator.java index 3476b8d570d..864c44148a0 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecorator.java @@ -35,6 +35,8 @@ import org.sonar.plugins.core.timemachine.ViolationTrackingDecorator; /** * Decorator that creates measures related to reviews. + * + * @since 2.14 */ @DependsUpon(CloseReviewsDecorator.REVIEW_LIFECYCLE_BARRIER) public class ReviewsMeasuresDecorator implements Decorator { @@ -64,7 +66,7 @@ public class ReviewsMeasuresDecorator implements Decorator { // Open reviews ReviewQuery openReviewQuery = ReviewQuery.create().setResourceId(resource.getId()).addStatus(ReviewDto.STATUS_OPEN) - .addStatus(ReviewDto.STATUS_REOPENED); + .addStatus(ReviewDto.STATUS_REOPENED); Double resourceOpenReviewsCount = reviewDao.countByQuery(openReviewQuery).doubleValue(); Double totalOpenReviewsCount = resourceOpenReviewsCount + getChildrenSum(resource, context, CoreMetrics.ACTIVE_REVIEWS); context.saveMeasure(CoreMetrics.ACTIVE_REVIEWS, totalOpenReviewsCount); @@ -85,14 +87,14 @@ public class ReviewsMeasuresDecorator implements Decorator { // False positive reviews ReviewQuery falsePositiveReviewQuery = ReviewQuery.create().setResourceId(resource.getId()) - .addResolution(ReviewDto.RESOLUTION_FALSE_POSITIVE); + .addResolution(ReviewDto.RESOLUTION_FALSE_POSITIVE); Double resourceFalsePositiveReviewsCount = reviewDao.countByQuery(falsePositiveReviewQuery).doubleValue(); Double totalFalsePositiveReviewsCount = resourceFalsePositiveReviewsCount + getChildrenSum(resource, context, CoreMetrics.FALSE_POSITIVE_REVIEWS); context.saveMeasure(CoreMetrics.FALSE_POSITIVE_REVIEWS, totalFalsePositiveReviewsCount); // Violations without a review - Double violationsCount = context.getMeasure(CoreMetrics.VIOLATIONS).getValue(); + Double violationsCount = MeasureUtils.getValue(context.getMeasure(CoreMetrics.VIOLATIONS), 0.0); context.saveMeasure(CoreMetrics.VIOLATIONS_WITHOUT_REVIEW, violationsCount - totalOpenReviewsCount); } |