From: Andreas Beeker Date: Fri, 29 Nov 2019 00:29:05 +0000 (+0000) Subject: GenericRecordJsonWriter fix output of floats and doubles X-Git-Tag: REL_4_1_2~123 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7aab19c3b58f4911bb28ac67df9785e58c8a5734;p=poi.git GenericRecordJsonWriter fix output of floats and doubles git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1870565 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/util/GenericRecordJsonWriter.java b/src/java/org/apache/poi/util/GenericRecordJsonWriter.java index 43e23f31ea..f8a0c85a4e 100644 --- a/src/java/org/apache/poi/util/GenericRecordJsonWriter.java +++ b/src/java/org/apache/poi/util/GenericRecordJsonWriter.java @@ -258,6 +258,15 @@ public class GenericRecordJsonWriter implements Closeable { protected boolean printNumber(String name, Object o) { Number n = (Number)o; printName(name); + + if (o instanceof Float) { + fw.print(n.floatValue()); + return true; + } else if (o instanceof Double) { + fw.print(n.doubleValue()); + return true; + } + fw.print(n.longValue()); final int size;