git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897138 13f79535-47bb-0310-9956-ffa450edef68tags/REL_5_2_1
@@ -26,7 +26,6 @@ import java.util.List; | |||
import java.util.Map; | |||
import java.util.function.Supplier; | |||
import org.apache.commons.math3.util.ArithmeticUtils; | |||
import org.apache.poi.hslf.model.textproperties.IndentProp; | |||
import org.apache.poi.util.GenericRecordUtil; | |||
import org.apache.poi.util.IOUtils; | |||
@@ -132,7 +131,7 @@ public final class MasterTextPropAtom extends RecordAtom { | |||
*/ | |||
private void write() { | |||
int pos = 0; | |||
long newSize = ArithmeticUtils.mulAndCheck((long)indents.size(), (long)6); | |||
long newSize = Math.multiplyExact((long)indents.size(), (long)6); | |||
_data = IOUtils.safelyAllocate(newSize, MAX_RECORD_LENGTH); | |||
for (IndentProp prop : indents) { | |||
LittleEndian.putInt(_data, pos, prop.getCharactersCovered()); |
@@ -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; |
@@ -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)); | |||
} | |||
/** |
@@ -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); | |||
} |