karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [1/2] karaf-decanter git commit: KARAF-4432 - Update the json marshaller to deal with infinity double
Date Tue, 22 Mar 2016 10:06:47 GMT
Repository: karaf-decanter
Updated Branches:
  refs/heads/master e9bd89f16 -> f0b749b5f


KARAF-4432 - Update the json marshaller to deal with infinity double


Project: http://git-wip-us.apache.org/repos/asf/karaf-decanter/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-decanter/commit/69bbf4b3
Tree: http://git-wip-us.apache.org/repos/asf/karaf-decanter/tree/69bbf4b3
Diff: http://git-wip-us.apache.org/repos/asf/karaf-decanter/diff/69bbf4b3

Branch: refs/heads/master
Commit: 69bbf4b3b60c04ac10c55117663aee8506d62ece
Parents: e9bd89f
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
Authored: Tue Mar 22 11:04:56 2016 +0100
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Tue Mar 22 11:04:56 2016 +0100

----------------------------------------------------------------------
 .../apache/karaf/decanter/marshaller/json/JsonMarshaller.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf-decanter/blob/69bbf4b3/marshaller/json/src/main/java/org/apache/karaf/decanter/marshaller/json/JsonMarshaller.java
----------------------------------------------------------------------
diff --git a/marshaller/json/src/main/java/org/apache/karaf/decanter/marshaller/json/JsonMarshaller.java
b/marshaller/json/src/main/java/org/apache/karaf/decanter/marshaller/json/JsonMarshaller.java
index fc4eefe..9bae949 100644
--- a/marshaller/json/src/main/java/org/apache/karaf/decanter/marshaller/json/JsonMarshaller.java
+++ b/marshaller/json/src/main/java/org/apache/karaf/decanter/marshaller/json/JsonMarshaller.java
@@ -176,7 +176,9 @@ public class JsonMarshaller implements Marshaller {
         } else if (value instanceof Float) {
             json.add(key, (Float)value);
         } else if (value instanceof Double) {
-            if (Double.isNaN((Double)value)) {
+            if (Double.isInfinite((Double)value)) {
+                json.add(key, "Infinity");
+            } else if (Double.isNaN((Double)value)) {
                 json.add(key, "NaN");
             } else {
                 json.add(key, (Double)value);


Mime
View raw message