diff --git a/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java b/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java index 160d7059a2a..d8c11089060 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java @@ -217,6 +217,8 @@ void test() throws Exception { } handleExtracting(file); + + handleAdditional(file); } @Test diff --git a/poi-ooxml/src/test/java/org/apache/poi/openxml4j/TestOPCPackageFileLimit.java b/poi-ooxml/src/test/java/org/apache/poi/openxml4j/TestOPCPackageFileLimit.java index 017de0a10e5..02f81ccd51a 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/openxml4j/TestOPCPackageFileLimit.java +++ b/poi-ooxml/src/test/java/org/apache/poi/openxml4j/TestOPCPackageFileLimit.java @@ -22,6 +22,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.util.ZipSecureFile; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Isolated; import java.io.File; import java.io.IOException; @@ -30,6 +31,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; +@Isolated // changes static values, so other tests should not run at the same time class TestOPCPackageFileLimit { @Test void testWithReducedFileLimit() throws InvalidFormatException { diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/eventusermodel/TestReadOnlySharedStringsTable.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/eventusermodel/TestReadOnlySharedStringsTable.java index be486270ed4..220963db79e 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/eventusermodel/TestReadOnlySharedStringsTable.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/eventusermodel/TestReadOnlySharedStringsTable.java @@ -67,6 +67,12 @@ void testParse() throws Exception { assertEquals(i1.getString(), rtbl.getItemAt(i).getString()); assertEquals(i1.getString(), rtbl2.getItemAt(i).getString()); } + + // verify invalid indices + assertThrows(IllegalStateException.class, + () -> rtbl.getItemAt(stbl.getUniqueCount())); + assertThrows(IndexOutOfBoundsException.class, + () -> rtbl.getItemAt(-1)); } } } diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java index 7fa5162a14c..9f55214ee55 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java @@ -1085,17 +1085,17 @@ private static class CountingOS extends OutputStream { int count; @Override - public void write(int b) throws IOException { + public void write(int b) { count++; } @Override - public void write(byte[] b) throws IOException { + public void write(byte[] b) { count += b.length; } @Override - public void write(byte[] b, int off, int len) throws IOException { + public void write(byte[] b, int off, int len) { count += len; }