]> source.dussan.org Git - poi.git/commitdiff
Bug 63805: BigDecimal: use enum args instead of integers (deprecated in Java 9)
authorDominik Stadler <centic@apache.org>
Fri, 25 Oct 2019 04:36:58 +0000 (04:36 +0000)
committerDominik Stadler <centic@apache.org>
Fri, 25 Oct 2019 04:36:58 +0000 (04:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1868897 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusDraw.java
src/testcases/org/apache/poi/ss/util/TestExpandedDouble.java

index e254d91816f7f9beee4060a99f623201b60afc3b..f1647bdf6a44076a255d4e787629dc987bab6077 100644 (file)
@@ -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) {
index c310f4a78da108f8c4bd1955bfd66a996e1bc2d6..6ae092a4f5b819d50f2c78dd4b7ab1a0f949b471 100644 (file)
@@ -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();
        }