aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
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());