Don't map JSON values to Double 70/84970/4
authorJim Hahn <jrh3@att.com>
Thu, 11 Apr 2019 00:08:30 +0000 (20:08 -0400)
committerJim Hahn <jrh3@att.com>
Thu, 11 Apr 2019 12:58:10 +0000 (08:58 -0400)
commitea29ed1a002ab282a36761448575ffc2e517284d
tree1127a1d9acd8899b5d39323b56465455e26320fe
parentf5586edf6bb68016b4259829b57ca7e3528b126a
Don't map JSON values to Double

By default, gson treats all numbers as Double when placed into a
generic Map.  This is not backward compatible with existing policy
APIs.  Added a type adapter that walks Map objects and converts the
Double values to Integer or Long, where possible.
Made this the default behavior in the GsonMessageBodyHandler, the
JacksonHandler, and the StandardCoder.
Also fixed a couple of checkstyle errors in the gson project.

Change-Id: I9ac0c77e6592d1c039646f0662c077b77a1e9aaf
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
12 files changed:
gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java
gson/src/main/java/org/onap/policy/common/gson/JacksonHandler.java
gson/src/main/java/org/onap/policy/common/gson/MapDoubleAdapterFactory.java [new file with mode: 0644]
gson/src/main/java/org/onap/policy/common/gson/internal/AnyGetterSerializer.java
gson/src/main/java/org/onap/policy/common/gson/internal/AnySetterDeserializer.java
gson/src/test/java/org/onap/policy/common/gson/GsonMessageBodyHandlerTest.java
gson/src/test/java/org/onap/policy/common/gson/JacksonHandlerTest.java
gson/src/test/java/org/onap/policy/common/gson/MapDoubleAdapterFactoryTest.java [new file with mode: 0644]
gson/src/test/java/org/onap/policy/common/gson/internal/DataAdapterFactory.java
utils/pom.xml
utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoder.java
utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java