aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/source/DuplicationLineReader.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/Result.java3
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterResult.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSort.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanDto.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java7
9 files changed, 18 insertions, 14 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/source/DuplicationLineReader.java b/server/sonar-server/src/main/java/org/sonar/server/computation/source/DuplicationLineReader.java
index bdd1bbea633..275f431da01 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/source/DuplicationLineReader.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/source/DuplicationLineReader.java
@@ -79,7 +79,7 @@ public class DuplicationLineReader implements LineReader {
}
private static int length(BatchReport.Range range) {
- return range.getEndLine() - range.getStartLine() + 1;
+ return (range.getEndLine() - range.getStartLine()) + 1;
}
private Map<BatchReport.Range, Integer> createDuplicationIdsByRange(List<BatchReport.Duplication> duplications) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java
index fcb32e591e8..1a264f90ba5 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java
@@ -171,8 +171,10 @@ public class DebtModelOperations implements ServerComponent {
return input != null && input.getKey().equals(dto.getKey());
}
});
- Integer nextPosition = moveUpOrDown ? (currentPosition > 0 ? currentPosition - 1 : null) : (currentPosition < rootCharacteristics.size() - 1 ? currentPosition + 1 : null);
- return nextPosition != null ? Iterables.get(rootCharacteristics, nextPosition) : null;
+ Integer nextPosition = moveUpOrDown ?
+ ((currentPosition > 0) ? (currentPosition - 1) : null) :
+ ((currentPosition < (rootCharacteristics.size() - 1)) ? (currentPosition + 1) : null);
+ return (nextPosition != null) ? Iterables.get(rootCharacteristics, nextPosition) : null;
}
/**
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java b/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java
index 49d56286d9a..ccf2c867502 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java
@@ -23,6 +23,7 @@ import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
+
import java.util.Arrays;
import java.util.List;
@@ -135,7 +136,7 @@ public class Result<T> {
if (!Arrays.equals(l10nParams, message.l10nParams)) {
return false;
}
- if (text != null ? !text.equals(message.text) : message.text != null) {
+ if ((text != null) ? !text.equals(message.text) : (message.text != null)) {
return false;
}
return true;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterResult.java b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterResult.java
index 80e0612af33..606938c5223 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterResult.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterResult.java
@@ -25,7 +25,7 @@ import java.util.List;
public class MeasureFilterResult {
- public static enum Error {
+ public enum Error {
UNKNOWN, VALUE_SHOULD_BE_A_NUMBER
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSort.java b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSort.java
index 584234f1e3a..08f8209bbd1 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSort.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSort.java
@@ -123,7 +123,7 @@ class MeasureFilterSort {
private String getMetricColumn() {
if (metric.isNumericType()) {
- return period != null ? "pmsort.variation_value_" + period : "pmsort.value";
+ return (period != null) ? ("pmsort.variation_value_" + period) : "pmsort.value";
} else {
return "pmsort.text_value";
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java
index f4521d664a6..d9912f45b4b 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java
@@ -202,7 +202,7 @@ public final class DebtDecorator implements Decorator {
public void add(@Nullable E key, Long value) {
if (key != null) {
Long currentValue = sumByKeys.get(key);
- sumByKeys.put(key, currentValue != null ? currentValue + value : value);
+ sumByKeys.put(key, (currentValue != null) ? (currentValue + value) : value);
}
}
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanDto.java b/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanDto.java
index fac4c384dab..e9179d67151 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanDto.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanDto.java
@@ -163,7 +163,7 @@ public class ActionPlanDto {
}
ActionPlanDto actionPlanDto = (ActionPlanDto) o;
- return !(id != null ? !id.equals(actionPlanDto.id) : actionPlanDto.id != null);
+ return !((id != null) ? !id.equals(actionPlanDto.id) : (actionPlanDto.id != null));
}
@Override
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java
index bdda2b6a865..06d2c2b53bb 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java
@@ -328,7 +328,7 @@ public class DefaultCharacteristic implements Characteristic {
DefaultCharacteristic that = (DefaultCharacteristic) o;
- if (key != null ? !key.equals(that.key) : that.key != null) {
+ if ((key != null) ? !key.equals(that.key) : (that.key != null)) {
return false;
}
return !(ruleKey != null ? !ruleKey.equals(that.ruleKey) : that.ruleKey != null);
@@ -337,8 +337,8 @@ public class DefaultCharacteristic implements Characteristic {
@Override
public int hashCode() {
- int result = key != null ? key.hashCode() : 0;
- result = 31 * result + (ruleKey != null ? ruleKey.hashCode() : 0);
+ int result = (key != null) ? key.hashCode() : 0;
+ result = 31 * result + ((ruleKey != null) ? ruleKey.hashCode() : 0);
return result;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java
index a181b788b75..9089c441836 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java
@@ -27,6 +27,7 @@ import org.sonar.api.config.Settings;
import org.sonar.api.i18n.I18n;
import javax.annotation.CheckForNull;
+
import java.util.Locale;
/**
@@ -113,15 +114,15 @@ public class Durations implements BatchComponent, ServerComponent {
private String format(Locale locale, int days, int hours, int minutes, boolean isNegative){
StringBuilder message = new StringBuilder();
if (days > 0) {
- message.append(message(locale, "work_duration.x_days", isNegative ? -1 * days : days));
+ message.append(message(locale, "work_duration.x_days", isNegative ? (-1 * days) : days));
}
if (displayHours(days, hours)) {
addSpaceIfNeeded(message);
- message.append(message(locale, "work_duration.x_hours", isNegative && message.length() == 0 ? -1 * hours : hours));
+ message.append(message(locale, "work_duration.x_hours", (isNegative && message.length() == 0) ? (-1 * hours) : hours));
}
if (displayMinutes(days, hours, minutes)) {
addSpaceIfNeeded(message);
- message.append(message(locale, "work_duration.x_minutes", isNegative && message.length() == 0 ? -1 * minutes : minutes));
+ message.append(message(locale, "work_duration.x_minutes", (isNegative && message.length() == 0) ? (-1 * minutes) : minutes));
}
return message.toString();
}