mirror of https://github.com/apache/poi.git
small big decimal refactor
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1900377 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
88441c4354
commit
5dd1ded85f
|
@ -952,9 +952,8 @@ public class DataFormatter {
|
|||
}
|
||||
String formatted;
|
||||
try {
|
||||
//see https://github.com/apache/poi/pull/321 -- but this sometimes fails as Double.toString
|
||||
//can produce strings that can't be parsed by BigDecimal
|
||||
formatted = numberFormat.format(new BigDecimal(Double.toString(d)));
|
||||
//see https://github.com/apache/poi/pull/321 -- but this sometimes fails, thus the catch and retry
|
||||
formatted = numberFormat.format(BigDecimal.valueOf(d));
|
||||
} catch (NumberFormatException nfe) {
|
||||
formatted = numberFormat.format(d);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue