From 3ed39620f6c7792c6c581075e0530cff9e0356bc Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 14 Apr 2022 21:46:13 +0000 Subject: [PATCH] revert fraction format change git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1899870 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/ss/usermodel/FractionFormat.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/FractionFormat.java b/poi/src/main/java/org/apache/poi/ss/usermodel/FractionFormat.java index f5ffd91faf..da1abe6b6e 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/FractionFormat.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/FractionFormat.java @@ -106,14 +106,8 @@ public class FractionFormat extends Format { @SuppressWarnings("squid:S2111") public String format(Number num) { - final double d = num.doubleValue();; - try { - //this is the recommended way (in BigDecimal javadocs to create a decimal from a double) - return format(new BigDecimal(Double.toString(d))); - } catch (NumberFormatException nfe) { - //Double.toString can fail - return format(d); - } + final double d = num.doubleValue(); + return format(new BigDecimal(d)); } @SuppressWarnings("squid:S2111")