summaryrefslogtreecommitdiffstats
path: root/utils/src/main/java/org
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-01-29 17:21:24 -0500
committerJim Hahn <jrh3@att.com>2020-01-29 17:27:29 -0500
commit7b420e72cf4b70eae77719f0c958a5ad25e8ce98 (patch)
tree8f4938c9c161d48a376753be739268e3bbbeb66f /utils/src/main/java/org
parent2ce955e7c3c53b16596a18b0f5f68f2b491d1de6 (diff)
Convert double to int when decoding JSON
When decoding straight into a List or Map class, StandardCoder was not applying the double-to-int conversion. Fixed it. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I939e3378645d45ac98d2bca6b2a4076870a05626
Diffstat (limited to 'utils/src/main/java/org')
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoder.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoder.java b/utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoder.java
index 26746b79..6d0cbc9d 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoder.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoder.java
@@ -38,6 +38,8 @@ import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Map;
import lombok.AccessLevel;
import lombok.Getter;
import org.onap.policy.common.gson.DoubleConverter;
@@ -286,7 +288,7 @@ public class StandardCoder implements Coder {
* @return the converted value
*/
protected <T> T convertFromDouble(Class<T> clazz, T value) {
- if (clazz != Object.class) {
+ if (clazz != Object.class && !Map.class.isAssignableFrom(clazz) && !List.class.isAssignableFrom(clazz)) {
return value;
}