You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2018/01/04 07:57:10 UTC

[GitHub] kwin commented on a change in pull request #1: Sling-7346-Json response converting response property value to string even if it is json object

kwin commented on a change in pull request #1: Sling-7346-Json response converting response property value to string even if it is json object
URL: https://github.com/apache/sling-org-apache-sling-servlets-post/pull/1#discussion_r159595351
 
 

 ##########
 File path: src/main/java/org/apache/sling/servlets/post/JSONResponse.java
 ##########
 @@ -103,9 +104,13 @@ JsonObject getJson() {
         JsonObjectBuilder jsonBuilder = Json.createObjectBuilder();
         for (Map.Entry<String, Object> entry : json.entrySet()) {
             if (entry.getValue() != null) {
-                jsonBuilder.add(entry.getKey(), entry.getValue().toString());
-            }
-            else {
+                try {
 
 Review comment:
   Instead of relying on exception handling please rather use an explicit check: https://docs.oracle.com/javaee/7/api/javax/json/JsonValue.html#getValueType--

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services