diff options
author | PJ Fanning <fanningpj@apache.org> | 2022-01-17 00:58:27 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2022-01-17 00:58:27 +0000 |
commit | f2d37da8fc4ca456d0794c3a97144b461378917a (patch) | |
tree | ad9fac6e9fa1b290fd9d22e0957910e2f899535b /poi | |
parent | a729b3c7e84a84be88ef0cc3550a32e31a96d3b1 (diff) | |
download | poi-f2d37da8fc4ca456d0794c3a97144b461378917a.tar.gz poi-f2d37da8fc4ca456d0794c3a97144b461378917a.zip |
remove use of deprecated commons-math methods
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897138 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
3 files changed, 5 insertions, 11 deletions
diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java index b9e85c08c0..222752eb78 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java @@ -33,7 +33,6 @@ import java.util.Iterator; import java.util.List; import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream; -import org.apache.commons.math3.util.ArithmeticUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.poi.EmptyFileException; @@ -127,7 +126,7 @@ public class POIFSFileSystem extends BlockStore protected void createNewDataSource() { // Data needs to initially hold just the header block, // a single bat block, and an empty properties section - long blockSize = ArithmeticUtils.mulAndCheck(bigBlockSize.getBigBlockSize(), 3L); + long blockSize = Math.multiplyExact(bigBlockSize.getBigBlockSize(), 3L); _data = new ByteArrayBackedDataSource(IOUtils.safelyAllocate(blockSize, MAX_RECORD_LENGTH)); } @@ -455,7 +454,7 @@ public class POIFSFileSystem extends BlockStore // Ensure there's a spot in the file for it ByteBuffer buffer = ByteBuffer.allocate(bigBlockSize.getBigBlockSize()); // Header isn't in BATs - long writeTo = ArithmeticUtils.mulAndCheck(1L + offset, bigBlockSize.getBigBlockSize()); + long writeTo = Math.multiplyExact(1L + offset, (long)bigBlockSize.getBigBlockSize()); _data.write(buffer, writeTo); // All done return newBAT; diff --git a/poi/src/main/java/org/apache/poi/poifs/property/RootProperty.java b/poi/src/main/java/org/apache/poi/poifs/property/RootProperty.java index c74a02a29d..8b5faaa4fd 100644 --- a/poi/src/main/java/org/apache/poi/poifs/property/RootProperty.java +++ b/poi/src/main/java/org/apache/poi/poifs/property/RootProperty.java @@ -17,7 +17,6 @@ package org.apache.poi.poifs.property; -import org.apache.commons.math3.util.ArithmeticUtils; import org.apache.poi.poifs.common.POIFSConstants; /** @@ -56,7 +55,7 @@ public final class RootProperty extends DirectoryProperty { { final int BLOCK_SHIFT = 6; final int _block_size = 1 << BLOCK_SHIFT; - super.setSize(ArithmeticUtils.mulAndCheck(size, _block_size)); + super.setSize(Math.multiplyExact(size, _block_size)); } /** diff --git a/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellWalk.java b/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellWalk.java index 480bcf5dd4..25e567f3ca 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellWalk.java +++ b/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellWalk.java @@ -17,10 +17,6 @@ package org.apache.poi.ss.util.cellwalk; -import static org.apache.commons.math3.util.ArithmeticUtils.addAndCheck; -import static org.apache.commons.math3.util.ArithmeticUtils.mulAndCheck; -import static org.apache.commons.math3.util.ArithmeticUtils.subAndCheck; - import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; @@ -93,9 +89,9 @@ public class CellWalk { continue; } - long rowSize = mulAndCheck(subAndCheck(ctx.rowNumber, firstRow), (long)width); + long rowSize = Math.multiplyExact(Math.subtractExact(ctx.rowNumber, firstRow), (long)width); - ctx.ordinalNumber = addAndCheck(rowSize, (ctx.colNumber - firstColumn + 1)); + ctx.ordinalNumber = Math.addExact(rowSize, (ctx.colNumber - firstColumn + 1)); handler.onCell(currentCell, ctx); } |