You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2021/12/15 13:45:51 UTC

[activemq-artemis] branch main updated: [ARTEMIS-3607]: Supporting JsonValues in JsonUtil.addToArray and JsonUtil.addToObject

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new dd645d0  [ARTEMIS-3607]: Supporting JsonValues in JsonUtil.addToArray and JsonUtil.addToObject
dd645d0 is described below

commit dd645d0d4ef7526804043bdbb3850546eba16d76
Author: Emmanuel Hugonnet <eh...@redhat.com>
AuthorDate: Wed Dec 15 09:01:15 2021 +0100

    [ARTEMIS-3607]: Supporting JsonValues in JsonUtil.addToArray and
    JsonUtil.addToObject
    
    * When the added Object is of type JsonValue, don't call the toString
      method on it.
    
    Issue: https://issues.apache.org/jira/browse/ARTEMIS-3607
---
 .../src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java  | 4 ++++
 1 file changed, 4 insertions(+)

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 052a09b0..dce5aad 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
@@ -173,6 +173,8 @@ public final class JsonUtil {
             addToArray(parameter, objectArrayBuilder);
          }
          jsonObjectBuilder.add(key, objectArrayBuilder);
+      } else if (param instanceof JsonValue) {
+         jsonObjectBuilder.add(key, (JsonValue)param);
       } else {
          jsonObjectBuilder.add(key, param.toString());
       }
@@ -218,6 +220,8 @@ public final class JsonUtil {
             addToArray(parameter, objectArrayBuilder);
          }
          jsonArrayBuilder.add(objectArrayBuilder);
+      } else if (param instanceof JsonValue) {
+         jsonArrayBuilder.add((JsonValue)param);
       } else {
          jsonArrayBuilder.add(param.toString());
       }