diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-09-03 11:35:37 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-09-04 15:17:26 +0200 |
commit | c19e6ff4081c25fce35e91de0219021ffaa05f3f (patch) | |
tree | 50e38090a82fd06203a75078e21c4558fce068a1 /sonar-batch | |
parent | 6f18dd7465bd8226c25d7f8e2f0d0acbf85956b9 (diff) | |
download | sonarqube-c19e6ff4081c25fce35e91de0219021ffaa05f3f.tar.gz sonarqube-c19e6ff4081c25fce35e91de0219021ffaa05f3f.zip |
Fix metrics of type MILLISEC
Underlying type must be long instead of int
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/report/MeasuresPublisher.java | 8 | ||||
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorStorage.java | 8 |
2 files changed, 6 insertions, 10 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/MeasuresPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/MeasuresPublisher.java index 0f601de4fd4..fecc5383dad 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/report/MeasuresPublisher.java +++ b/sonar-batch/src/main/java/org/sonar/batch/report/MeasuresPublisher.java @@ -86,13 +86,13 @@ public class MeasuresPublisher implements ReportPublisherStep { builder.setBooleanValue((Boolean) value); break; case DOUBLE: - builder.setDoubleValue((Double) value); + builder.setDoubleValue(((Number) value).doubleValue()); break; case INT: - builder.setIntValue((Integer) value); + builder.setIntValue(((Number) value).intValue()); break; case LONG: - builder.setLongValue((Long) value); + builder.setLongValue(((Number) value).longValue()); break; case STRING: builder.setStringValue((String) value); @@ -105,7 +105,6 @@ public class MeasuresPublisher implements ReportPublisherStep { private MeasureValueType getMeasureValueType(ValueType type) { switch (type) { case INT: - case MILLISEC: case RATING: return MeasureValueType.INT; case FLOAT: @@ -119,6 +118,7 @@ public class MeasuresPublisher implements ReportPublisherStep { case DISTRIB: return MeasureValueType.STRING; case WORK_DUR: + case MILLISEC: return MeasureValueType.LONG; default: throw new IllegalStateException("Unknown value type: " + type); diff --git a/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorStorage.java b/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorStorage.java index 8cef84ace5b..0c6a9d67fa2 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorStorage.java +++ b/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorStorage.java @@ -160,12 +160,11 @@ public class DefaultSensorStorage implements SensorStorage { break; case INT: case MILLISEC: - measureToSave.setValue(Double.valueOf((Integer) measure.value())); - break; + case WORK_DUR: case FLOAT: case PERCENT: case RATING: - measureToSave.setValue((Double) measure.value()); + measureToSave.setValue(((Number) measure.value()).doubleValue()); break; case STRING: case LEVEL: @@ -173,9 +172,6 @@ public class DefaultSensorStorage implements SensorStorage { case DISTRIB: measureToSave.setData((String) measure.value()); break; - case WORK_DUR: - measureToSave.setValue(Double.valueOf((Long) measure.value())); - break; default: throw new UnsupportedOperationException("Unsupported type :" + m.getType()); } |