aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/measure/Measure.java10
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/source/DuplicationLineReader.java8
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStep.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskFormatter.java36
4 files changed, 35 insertions, 26 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/measure/Measure.java b/server/sonar-server/src/main/java/org/sonar/server/computation/measure/Measure.java
index a0356435cbc..759d4fa0ef4 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/measure/Measure.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/measure/Measure.java
@@ -223,6 +223,11 @@ public final class Measure {
public Measure createNoValue() {
return new Measure(ValueType.NO_VALUE, ruleId, characteristicId, developer, null, null, null, description, qualityGateStatus, variations);
}
+
+ private static double scale(double value, int decimalScale) {
+ BigDecimal bd = BigDecimal.valueOf(value);
+ return bd.setScale(decimalScale, RoundingMode.HALF_UP).doubleValue();
+ }
}
public static final class UpdateMeasureBuilder {
@@ -455,9 +460,4 @@ public final class Measure {
.add("description", description)
.toString();
}
-
- private static double scale(double value, int decimalScale) {
- BigDecimal bd = BigDecimal.valueOf(value);
- return bd.setScale(decimalScale, RoundingMode.HALF_UP).doubleValue();
- }
}
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 f385d2563fc..689864421fe 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
@@ -57,10 +57,6 @@ public class DuplicationLineReader implements LineReader {
}
}
- private static boolean isLineInBlock(TextBlock range, int line) {
- return line >= range.getStart() && line <= range.getEnd();
- }
-
/**
*
* <p>
@@ -106,6 +102,10 @@ public class DuplicationLineReader implements LineReader {
public boolean apply(@Nonnull Map.Entry<TextBlock, Integer> input) {
return isLineInBlock(input.getKey(), line);
}
+
+ private static boolean isLineInBlock(TextBlock range, int line) {
+ return line >= range.getStart() && line <= range.getEnd();
+ }
}
private enum MapEntryToBlockId implements Function<Map.Entry<TextBlock, Integer>, Integer> {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStep.java
index 200e540a400..726c28cb9d3 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStep.java
@@ -56,17 +56,18 @@ public class LoadReportAnalysisMetadataHolderStep implements ComputationStep {
private void checkProjectKeyConsistency(BatchReport.Metadata reportMetadata) {
String reportProjectKey = projectKeyFromReport(reportMetadata);
- if (ceTask.getComponentKey() == null) {
+ String componentKey = ceTask.getComponentKey();
+ if (componentKey == null) {
throw MessageException.of(format(
"Compute Engine task component key is null. Project with UUID %s must have been deleted since report was uploaded. Can not proceed.",
ceTask.getComponentUuid()
));
}
- if (!ceTask.getComponentKey().equals(reportProjectKey)) {
+ if (!componentKey.equals(reportProjectKey)) {
throw MessageException.of(format(
"ProjectKey in report (%s) is not consistent with projectKey under which the report as been submitted (%s)",
reportProjectKey,
- ceTask.getComponentKey()
+ componentKey
));
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskFormatter.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskFormatter.java
index 5913f9acdf3..bfb9be84096 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskFormatter.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskFormatter.java
@@ -144,30 +144,38 @@ public class TaskFormatter {
private static Set<String> ceQueueDtoToComponentUuids(Iterable<CeQueueDto> dtos) {
return from(dtos)
- .transform(new Function<CeQueueDto, String>() {
- @Override
- @Nullable
- public String apply(@Nonnull CeQueueDto input) {
- return input.getComponentUuid();
- }
- })
+ .transform(CeQueueDtoToComponentUuid.INSTANCE)
.filter(notNull())
.toSet();
}
private static Set<String> ceActivityDtoToComponentUuids(Iterable<CeActivityDto> dtos) {
return from(dtos)
- .transform(new Function<CeActivityDto, String>() {
- @Override
- @Nullable
- public String apply(@Nonnull CeActivityDto input) {
- return input.getComponentUuid();
- }
- })
+ .transform(CeActivityDtoToComponentUuid.INSTANCE)
.filter(notNull())
.toSet();
}
+ private enum CeQueueDtoToComponentUuid implements Function<CeQueueDto, String> {
+ INSTANCE;
+
+ @Override
+ @Nullable
+ public String apply(@Nonnull CeQueueDto input) {
+ return input.getComponentUuid();
+ }
+ }
+
+ private enum CeActivityDtoToComponentUuid implements Function<CeActivityDto, String> {
+ INSTANCE;
+
+ @Override
+ @Nullable
+ public String apply(@Nonnull CeActivityDto input) {
+ return input.getComponentUuid();
+ }
+ }
+
private class ComponentDtoCache {
private final Map<String, ComponentDto> componentsByUuid;