Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5EC03200B51 for ; Mon, 1 Aug 2016 20:15:52 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5D702160AA7; Mon, 1 Aug 2016 18:15:52 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AF44C160A66 for ; Mon, 1 Aug 2016 20:15:51 +0200 (CEST) Received: (qmail 64398 invoked by uid 500); 1 Aug 2016 18:15:50 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 64389 invoked by uid 99); 1 Aug 2016 18:15:50 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Aug 2016 18:15:50 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C5B28E058E; Mon, 1 Aug 2016 18:15:50 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jbertram@apache.org To: commits@activemq.apache.org Date: Mon, 01 Aug 2016 18:15:50 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] activemq-artemis git commit: ARTEMIS-565 another JSON fix archived-at: Mon, 01 Aug 2016 18:15:52 -0000 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 Authored: Mon Aug 1 13:54:04 2016 -0400 Committer: Clebert Suconic 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++) {