aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-07-02 09:14:04 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-07-02 09:22:54 +0200
commit9a177176c182387fa6b89911eb88bab567a95a11 (patch)
tree070312c689dbb961b9bd1ed279c72da55540be77 /sonar-batch
parent93d72d7a45b3e4ffb7098254e7fc61fffeb2417b (diff)
downloadsonarqube-9a177176c182387fa6b89911eb88bab567a95a11.tar.gz
sonarqube-9a177176c182387fa6b89911eb88bab567a95a11.zip
Fix some quality flaw
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureValueCoder.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureValueCoder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureValueCoder.java
index d3e0677e86c..7f010d97d0a 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureValueCoder.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureValueCoder.java
@@ -69,7 +69,11 @@ class MeasureValueCoder implements ValueCoder {
public Object get(Value value, Class clazz, CoderContext context) {
Measure<?> m = new Measure();
String metricKey = value.getString();
- m.setMetric(metricFinder.findByKey(metricKey));
+ Metric metric = metricFinder.findByKey(metricKey);
+ if (metric == null) {
+ throw new IllegalStateException("Unknow metric with key " + metricKey);
+ }
+ m.setMetric(metric);
m.setRawValue(value.isNull(true) ? null : value.getDouble());
m.setData(value.getString());
m.setDescription(value.getString());