import java.util.Locale;
import java.util.Map;
-import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.ErrorEval;
-import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.apache.poi.ss.formula.udf.UDFFinder;
import org.apache.poi.ss.usermodel.Row;
if (totalsRowCount == 1) { // never seen more than one totals row
XSSFRow totalsRow = sheet.getRow(clonedTable.getEndCellReference().getRow());
if (clonedTable.getCTTable().getTableColumns() != null
- && clonedTable.getCTTable().getTableColumns().getTableColumnList().size() > 0) {
+ && !clonedTable.getCTTable().getTableColumns().getTableColumnList().isEmpty()) {
clonedTable.getCTTable().setTotalsRowCount(totalsRowCount);
for (int i = 0; i < clonedTable.getCTTable().getTableColumns().getTableColumnList().size(); i++) {
CTTableColumn tableCol = table.getCTTable().getTableColumns().getTableColumnList().get(i);
// clone calculated column formulas
if (clonedTable.getCTTable().getTableColumns() != null
- && clonedTable.getCTTable().getTableColumns().getTableColumnList().size() > 0) {
+ && !clonedTable.getCTTable().getTableColumns().getTableColumnList().isEmpty()) {
clonedTable.getCTTable().setTotalsRowCount(totalsRowCount);
for (int i = 0; i < clonedTable.getCTTable().getTableColumns().getTableColumnList().size(); i++) {
CTTableColumn tableCol = table.getCTTable().getTableColumns().getTableColumnList().get(i);
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
-public class TestXSLFSlideCopy {
+class TestXSLFSlideCopy {
private static final POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
@Test
- public void testCopySlide() throws IOException {
+ void testCopySlide() throws IOException {
final String shapeName = "title";
try (
InputStream stream = slTests.openResourceAsStream("copy-slide-demo.pptx");
import static org.apache.poi.POITestCase.assertStartsWith;
import static org.junit.jupiter.api.Assertions.*;
-public final class TestSXSSFWorkbookWithNullAutoSizeTracker extends BaseTestXWorkbook {
+final class TestSXSSFWorkbookWithNullAutoSizeTracker extends BaseTestXWorkbook {
- public TestSXSSFWorkbookWithNullAutoSizeTracker() {
+ TestSXSSFWorkbookWithNullAutoSizeTracker() {
super(SXSSFITestDataProviderWithNullAutoSizeTracker.instance);
}
}
@Test
- public void disableAutoSizeTracker() throws IOException {
+ void disableAutoSizeTracker() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook(10)) {
assertThrows(IllegalStateException.class, () -> {
Sheet sheet = workbook.createSheet("testSheet");
/**
* Tests for XSSFBubbleChartData.
*/
-public final class TestXSSFBubbleChartData {
+final class TestXSSFBubbleChartData {
@Test
void testExample() throws IOException {
size += LittleEndianConsts.INT_SIZE;
}
- brushBytes = IOUtils.toByteArray(leis, (int)(dataSize-size), MAX_OBJECT_SIZE);
+ brushBytes = IOUtils.toByteArray(leis, Math.toIntExact(dataSize-size), MAX_OBJECT_SIZE);
return dataSize;
}
// gradient is repeated.
wrapMode = EmfPlusWrapMode.valueOf(leis.readInt());
- int size = 2 * LittleEndianConsts.INT_SIZE;
+ long size = 2L * LittleEndianConsts.INT_SIZE;
size += readRectF(leis, rect);
// An EmfPlusARGB object that specifies the color at the starting/ending boundary point of the linear gradient brush.
// skip reserved1/2 fields
leis.skipFully(2 * LittleEndianConsts.INT_SIZE);
- size += 4 * LittleEndianConsts.INT_SIZE;
+ size += 4L * LittleEndianConsts.INT_SIZE;
if (TRANSFORM.isSet(dataFlags)) {
- size += readXForm(leis, (blendTransform = new AffineTransform()));
+ blendTransform = new AffineTransform();
+ size += readXForm(leis, blendTransform);
}
if (isPreset() && (isBlendH() || isBlendV())) {
// that appears at the center point of the brush. The color of the brush changes gradually from the
// boundary color to the center color as it moves from the boundary to the center point.
centerColor = readARGB(leis.readInt());
- long size = 3*LittleEndianConsts.INT_SIZE;
+ long size = 3L * LittleEndianConsts.INT_SIZE;
if (wrapMode == null) {
return size;
for (int i = 0; i < colorCount; i++) {
surroundingColor[i] = readARGB(leis.readInt());
}
- size += (colorCount + 1) * LittleEndianConsts.INT_SIZE;
+ size += (colorCount + 1L) * LittleEndianConsts.INT_SIZE;
// The boundary of the path gradient brush, which is specified by either a path or a closed cardinal spline.
// If the BrushDataPath flag is set in the BrushDataFlags field, this field MUST contain an
size += 3*LittleEndianConsts.INT_SIZE;
}
- return Math.toIntExact(size);
+ return size;
}
@Override
// across a shape, when the image is smaller than the area being filled.
wrapMode = EmfPlusWrapMode.valueOf(leis.readInt());
- long size = 2*LittleEndianConsts.INT_SIZE;
+ long size = 2L * LittleEndianConsts.INT_SIZE;
if (TRANSFORM.isSet(dataFlags)) {
- size += readXForm(leis, (brushTransform = new AffineTransform()));
+ brushTransform = new AffineTransform();
+ size += readXForm(leis, brushTransform);
}
if (dataSize > size) {
- size += (image = new EmfPlusImage()).init(leis, dataSize-size, EmfPlusObjectType.IMAGE, 0);
+ image = new EmfPlusImage();
+ size += image.init(leis, dataSize-size, EmfPlusObjectType.IMAGE, 0);
}
return Math.toIntExact(size);
import java.io.PrintStream;
import java.util.ArrayList;
-import java.util.Comparator;
import org.apache.poi.hsmf.datatypes.MAPIProperty;
import org.apache.poi.util.StringUtil;
import org.apache.poi.poifs.crypt.standard.EncryptionRecord;
import org.apache.poi.poifs.filesystem.DirectoryEntry;
import org.apache.poi.poifs.filesystem.DocumentEntry;
-import org.apache.poi.poifs.filesystem.POIFSWriterEvent;
-import org.apache.poi.poifs.filesystem.POIFSWriterListener;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndianByteArrayOutputStream;
import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.poifs.crypt.HashAlgorithm;
import org.apache.poi.poifs.crypt.standard.EncryptionRecord;
import org.apache.poi.poifs.filesystem.DirectoryNode;
-import org.apache.poi.util.LittleEndianByteArrayOutputStream;
import org.apache.poi.util.RandomSingleton;
public class BinaryRC4Encryptor extends Encryptor {
import org.apache.poi.poifs.filesystem.POIFSWriterEvent;
import org.apache.poi.poifs.filesystem.POIFSWriterListener;
import org.apache.poi.util.IOUtils;
-import org.apache.poi.util.LittleEndianByteArrayOutputStream;
import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.LittleEndianOutputStream;
import org.apache.poi.util.RandomSingleton;