diff options
3 files changed, 7 insertions, 6 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java b/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java index a1c30dff0dc..3a72095367c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java @@ -110,8 +110,9 @@ public class CoverageService implements ServerComponent { DbSession session = myBatis.openSession(false); try { MeasureDto data = measureDao.getNullableByKey(session, MeasureKey.of(fileKey, metricKey)); - if (data != null) { - return KeyValueFormat.parseIntInt(data.getData()); + String dataValue = data != null ? data.getData() : null; + if (dataValue != null) { + return KeyValueFormat.parseIntInt(dataValue); } return Maps.newHashMap(); } finally { diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoverageShowAction.java b/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoverageShowAction.java index 3ca0e0b5f8a..27550987820 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoverageShowAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoverageShowAction.java @@ -95,7 +95,7 @@ public class CoverageShowAction implements RequestHandler { int from = Math.max(request.mandatoryParamAsInt(FROM), 1); int to = (Integer) ObjectUtils.defaultIfNull(request.paramAsInt(TO), Integer.MAX_VALUE); - CoverageService.TYPE type = CoverageService.TYPE.valueOf(request.param(TYPE)); + CoverageService.TYPE type = CoverageService.TYPE.valueOf(request.mandatoryParam(TYPE)); JsonWriter json = response.newJsonWriter().beginObject(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java index 3b1a1f49fbb..e1b767a9b63 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java @@ -137,14 +137,14 @@ public final class SqaleRatingDecorator implements Decorator { if (measure != null) { return measure.getValue().longValue(); } - return 0; + return 0L; } protected double computeDensity(double debt, double developmentCost) { - if (developmentCost != 0) { + if (developmentCost != 0f) { return debt / developmentCost; } - return 0; + return 0f; } } |