aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-06-27 16:33:37 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2013-06-27 16:34:15 +0200
commit7727f8c087ddfd4675d1b943e35f44122eddb275 (patch)
tree3d860439445445374908b54624f4952edb67e893 /sonar-ws-client
parent89cdd0f041c162fb255fdcad15ca75a6ab834dd9 (diff)
downloadsonarqube-7727f8c087ddfd4675d1b943e35f44122eddb275.tar.gz
sonarqube-7727f8c087ddfd4675d1b943e35f44122eddb275.zip
SONAR-4381 ClassCastException when unmarshalling response from manual measure WS
Diffstat (limited to 'sonar-ws-client')
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/JsonUtils.java3
-rw-r--r--sonar-ws-client/src/test/resources/manual_measures/all_measures.json6
2 files changed, 6 insertions, 3 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/JsonUtils.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/JsonUtils.java
index 0f9381fffac..c767b5602f4 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/JsonUtils.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/JsonUtils.java
@@ -69,6 +69,9 @@ public final class JsonUtils {
public static Double getDouble(Map obj, String field) {
Object value = obj.get(field);
if (value != null) {
+ if (value instanceof Long) {
+ return ((Long) value).doubleValue();
+ }
return (Double) value;
}
return null;
diff --git a/sonar-ws-client/src/test/resources/manual_measures/all_measures.json b/sonar-ws-client/src/test/resources/manual_measures/all_measures.json
index 05bce196c2d..2adfa725223 100644
--- a/sonar-ws-client/src/test/resources/manual_measures/all_measures.json
+++ b/sonar-ws-client/src/test/resources/manual_measures/all_measures.json
@@ -3,7 +3,7 @@
"id":1,
"metric":"burned_budget",
"resource":"org.apache.struts:struts-parent",
- "val":302.0,
+ "val":302.1,
"created_at":"2011-07-27T10:22:34+0200",
"updated_at":"2011-07-27T10:22:34+0200",
"login":"admin",
@@ -13,10 +13,10 @@
"id":2,
"metric":"team_size",
"resource":"org.apache.struts:struts-parent",
- "val":555.0,
+ "val":555,
"created_at":"2011-07-27T10:53:33+0200",
"updated_at":"2011-07-27T10:53:33+0200",
"login":"admin",
"username":"Administrator"
}
-] \ No newline at end of file
+]