summaryrefslogtreecommitdiffstats
path: root/vespajlib
diff options
context:
space:
mode:
authorArne Juul <arnej@yahoo-inc.com>2018-06-21 11:52:19 +0000
committerArne Juul <arnej@yahoo-inc.com>2018-06-25 11:09:23 +0000
commit529f073074afd9eebc3a0841cf9b374dc6501732 (patch)
tree4df6305992e0c506471a20c8a3a3b0c2f545e5e9 /vespajlib
parenta5fcfcf14cbc5778af9480f3b4efb93138020499 (diff)
stop using DoubleFormatter
* also, update expected results in those places where slight differences in Double formatting was seen.
Diffstat (limited to 'vespajlib')
-rw-r--r--vespajlib/src/main/java/com/yahoo/data/access/simple/JsonRender.java7
-rw-r--r--vespajlib/src/main/java/com/yahoo/slime/JsonFormat.java7
2 files changed, 6 insertions, 8 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/data/access/simple/JsonRender.java b/vespajlib/src/main/java/com/yahoo/data/access/simple/JsonRender.java
index bc4543011b3..53be6a82dd2 100644
--- a/vespajlib/src/main/java/com/yahoo/data/access/simple/JsonRender.java
+++ b/vespajlib/src/main/java/com/yahoo/data/access/simple/JsonRender.java
@@ -1,7 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.data.access.simple;
-import com.yahoo.text.DoubleFormatter;
import com.yahoo.data.access.*;
/**
@@ -52,10 +51,10 @@ public final class JsonRender
}
private void encodeDOUBLE(double value) {
- if (Double.isNaN(value) || Double.isInfinite(value)) {
- out.append("null");
+ if (Double.isFinite(value)) {
+ out.append(String.valueOf(value));
} else {
- out.append(DoubleFormatter.stringValue(value));
+ out.append("null");
}
}
diff --git a/vespajlib/src/main/java/com/yahoo/slime/JsonFormat.java b/vespajlib/src/main/java/com/yahoo/slime/JsonFormat.java
index d908359df19..c4c82609df7 100644
--- a/vespajlib/src/main/java/com/yahoo/slime/JsonFormat.java
+++ b/vespajlib/src/main/java/com/yahoo/slime/JsonFormat.java
@@ -6,7 +6,6 @@ import com.yahoo.io.ByteWriter;
import com.yahoo.text.AbstractUtf8Array;
import com.yahoo.text.Utf8;
import com.yahoo.text.Utf8String;
-import com.yahoo.text.DoubleFormatter;
import java.io.*;
@@ -107,10 +106,10 @@ public final class JsonFormat implements SlimeFormat
}
private void encodeDOUBLE(double value) throws IOException {
- if (Double.isNaN(value) || Double.isInfinite(value)) {
- out.write(NULL);
+ if (Double.isFinite(value)) {
+ out.write(String.valueOf(value));
} else {
- out.write(DoubleFormatter.stringValue(value));
+ out.write(NULL);
}
}