From: Duarte Meneses Date: Wed, 16 Oct 2019 21:19:10 +0000 (-0500) Subject: minor fixes X-Git-Tag: 8.1.0.31237~182 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3e23d75c7c9fbb647c75a1a98671c996596c265b;p=sonarqube.git minor fixes --- diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java index 1bcc58d7529..96f9530be16 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java @@ -359,7 +359,6 @@ public interface Measure { class NoValueVariationMeasureImpl implements Measure { @Nullable private Double variation; - private ValueType valueType = ValueType.NO_VALUE; private NoValueVariationMeasureImpl(@Nullable Double variation) { this.variation = variation; @@ -430,7 +429,7 @@ public interface Measure { @Override public String toString() { return com.google.common.base.MoreObjects.toStringHelper(this) - .add("valueType", valueType) + .add("valueType", ValueType.NO_VALUE) .add("variations", variation) .toString(); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoImpl.java index 44fe0b8f319..c73f5707ceb 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoImpl.java @@ -51,15 +51,10 @@ public class ScmInfoImpl implements ScmInfo { @Override public Changeset getChangesetForLine(int lineNumber) { - if (lineNumber < 1 || lineNumber > lineChangesets.length) { + if (!hasChangesetForLine(lineNumber)) { throw new IllegalArgumentException("There's no changeset on line " + lineNumber); - - } - Changeset changeset = lineChangesets[lineNumber - 1]; - if (changeset != null) { - return changeset; } - throw new IllegalArgumentException("There's no changeset on line " + lineNumber); + return lineChangesets[lineNumber - 1]; } @Override diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/DoubleCache.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/DoubleCache.java index 5b51ad882e7..10d0defaf02 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/DoubleCache.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/DoubleCache.java @@ -19,6 +19,7 @@ */ package org.sonar.ce.task.projectanalysis.util.cache; +import javax.annotation.CheckForNull; import javax.annotation.Nullable; public class DoubleCache { @@ -30,6 +31,7 @@ public class DoubleCache { // static only } + @CheckForNull public static Double intern(@Nullable Double num) { if (ZERO.equals(num)) { return ZERO;