From 7aab19c3b58f4911bb28ac67df9785e58c8a5734 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Fri, 29 Nov 2019 00:29:05 +0000 Subject: [PATCH] GenericRecordJsonWriter fix output of floats and doubles git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1870565 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/util/GenericRecordJsonWriter.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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; -- 2.39.5