aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
index c3f56101a18..1901863576a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
@@ -248,26 +248,26 @@ public class Measure<G extends Serializable> implements Serializable {
public G value() {
switch (getMetric().getType()) {
case BOOL:
- return (G) Boolean.valueOf(Double.doubleToRawLongBits(value) != 0L);
+ return value == null ? null : (G) Boolean.valueOf(Double.doubleToRawLongBits(value) != 0L);
case INT:
case MILLISEC:
- return (G) Integer.valueOf(value.intValue());
+ case RATING:
+ return value == null ? null : (G) Integer.valueOf(value.intValue());
case FLOAT:
case PERCENT:
- case RATING:
- return (G) value;
+ return value == null ? null : (G) value;
case STRING:
case LEVEL:
case DATA:
case DISTRIB:
- return (G) getData();
+ return data == null ? null : (G) data;
case WORK_DUR:
- return (G) Long.valueOf(value.longValue());
+ return value == null ? null : (G) Long.valueOf(value.longValue());
default:
if (getMetric().isNumericType()) {
- return (G) getValue();
+ return value == null ? null : (G) value;
} else if (getMetric().isDataType()) {
- return (G) getData();
+ return data == null ? null : (G) data;
} else {
throw new UnsupportedOperationException("Unsupported type :" + getMetric().getType());
}