cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Torkian (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-6166) Parsing Bug in org.apache.cxf.jaxrs.provider.json.JsonMapObjectReaderWriter
Date Mon, 05 Jan 2015 11:00:35 GMT

    [ https://issues.apache.org/jira/browse/CXF-6166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14264485#comment-14264485
] 

Daniel Torkian commented on CXF-6166:
-------------------------------------

Dear Sergey,

happy new year 2015.

thank you for your effort. I have still doubts whether long is sufficient alone. what would
you think of this proposal?

{code:java}
diff --git a/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectReaderWriter.java
b/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectReaderWriter.java
index 343bad5..623ace0 100644
--- a/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectReaderWriter.java
+++ b/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JsonMapObjectReaderWriter.java
@@ -200,8 +200,14 @@ public class JsonMapObjectReaderWriter {
             value = valueStr.substring(1, valueStr.length() - 1);
         } else if ("true".equals(value) || "false".equals(value)) {
             value = Boolean.valueOf(valueStr);
+        } else if ("null".equals(value)){
+            value = "null";
         } else {
-            value = Long.valueOf(valueStr);
+        	try {
+				value = Long.parseLong(valueStr);
+			} catch (Exception e) {
+				value = Double.valueOf(valueStr);
+			}
         }
         return value;
     }

{code}

Thanks
Daniel

> Parsing Bug in org.apache.cxf.jaxrs.provider.json.JsonMapObjectReaderWriter
> ---------------------------------------------------------------------------
>
>                 Key: CXF-6166
>                 URL: https://issues.apache.org/jira/browse/CXF-6166
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.0.3, 3.0.4, 3.1.0
>            Reporter: Daniel Torkian
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>              Labels: JAXRS, JSON, Parsing
>             Fix For: 3.0.4, 3.1.0
>
>         Attachments: bugJsonMapObjectReaderWriter.txt
>
>
> Parsing Bug in org.apache.cxf.jaxrs.provider.json.JsonMapObjectReaderWriter.
> See Patch



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message