diff options
author | Dominik Stadler <centic@apache.org> | 2019-10-25 04:36:58 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2019-10-25 04:36:58 +0000 |
commit | 468346fca8ce777ecfdefd8d5125b71638315ea9 (patch) | |
tree | bcfe93f04b8e67e1ad63f994d0d25a30cbd0a41c /src | |
parent | 0629fd1acb51ee94bd39a04689748b75cd196192 (diff) | |
download | poi-468346fca8ce777ecfdefd8d5125b71638315ea9.tar.gz poi-468346fca8ce777ecfdefd8d5125b71638315ea9.zip |
Bug 63805: BigDecimal: use enum args instead of integers (deprecated in Java 9)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1868897 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusDraw.java | 3 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/ss/util/TestExpandedDouble.java | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusDraw.java b/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusDraw.java index e254d91816..f1647bdf6a 100644 --- a/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusDraw.java +++ b/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusDraw.java @@ -28,6 +28,7 @@ import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; @@ -789,7 +790,7 @@ public class HemfPlusDraw { static double round10(double d) { - return new BigDecimal(d).setScale(10, BigDecimal.ROUND_HALF_UP).doubleValue(); + return new BigDecimal(d).setScale(10, RoundingMode.HALF_UP).doubleValue(); } static int readRectS(LittleEndianInputStream leis, Rectangle2D bounds) { diff --git a/src/testcases/org/apache/poi/ss/util/TestExpandedDouble.java b/src/testcases/org/apache/poi/ss/util/TestExpandedDouble.java index c310f4a78d..6ae092a4f5 100644 --- a/src/testcases/org/apache/poi/ss/util/TestExpandedDouble.java +++ b/src/testcases/org/apache/poi/ss/util/TestExpandedDouble.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals; import java.math.BigDecimal; import java.math.BigInteger; +import java.math.RoundingMode; import org.apache.poi.util.HexDump; import org.junit.Test; @@ -152,7 +153,7 @@ public final class TestExpandedDouble { BigDecimal bd = new BigDecimal(hd.getSignificand()).divide(new BigDecimal(BigInteger.ONE.shiftLeft(gg))); int excessPrecision = bd.precision() - 23; if (excessPrecision > 0) { - bd = bd.setScale(bd.scale() - excessPrecision, BigDecimal.ROUND_HALF_UP); + bd = bd.setScale(bd.scale() - excessPrecision, RoundingMode.HALF_UP); } return bd.unscaledValue().toString(); } @@ -189,7 +190,7 @@ public final class TestExpandedDouble { } int excessPrecision = bd.precision() - nDec; if (excessPrecision > 0) { - bd = bd.setScale(bd.scale() - excessPrecision, BigDecimal.ROUND_HALF_UP); + bd = bd.setScale(bd.scale() - excessPrecision, RoundingMode.HALF_UP); } return bd.unscaledValue(); } |