Repository: activemq-artemis Updated Branches: refs/heads/master 57f79cae0 -> ae47eae5a
ARTEMIS-565 another JSON fix Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/a5360e42 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/a5360e42 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/a5360e42 Branch: refs/heads/master Commit: a5360e42df3055dec9524936e733a0f8bcee153c Parents: 57f79ca Author: Clebert Suconic <[email protected]> Authored: Mon Aug 1 13:54:04 2016 -0400 Committer: Clebert Suconic <[email protected]> Committed: Mon Aug 1 13:54:04 2016 -0400 ---------------------------------------------------------------------- .../activemq/artemis/api/core/JsonUtil.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a5360e42/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java index 0343a64..e50540d 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java @@ -325,6 +325,24 @@ public final class JsonUtil { return jsonValue.toString(); } } + else if (jsonValue instanceof Number) { + Number jsonNumber = (Number)jsonValue; + if (desiredType == Integer.TYPE || desiredType == Integer.class) { + return jsonNumber.intValue(); + } + else if (desiredType == Long.TYPE || desiredType == Long.class) { + return jsonNumber.longValue(); + } + else if (desiredType == Double.TYPE || desiredType == Double.class) { + return jsonNumber.doubleValue(); + } + else if (desiredType == Short.TYPE || desiredType == Short.class) { + return jsonNumber.shortValue(); + } + else { + return jsonValue; + } + } else if (jsonValue instanceof Object[]) { Object[] array = (Object[]) jsonValue; for (int i = 0; i < array.length; i++) {
