You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2021/04/15 14:25:45 UTC

svn commit: r1888792 - in /poi/trunk: poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/ poi/src/main/java/org/apache/poi/util/ poi/src/test/java/org/apache/poi/util/

Author: centic
Date: Thu Apr 15 14:25:44 2021
New Revision: 1888792

URL: http://svn.apache.org/viewvc?rev=1888792&view=rev
Log:
Junit 5: Run some tests which change static BYTE_ARRAY_MAX_OVERRIDE in isolation

Otherwise many other tests can become flaky if the value is set very low

Modified:
    poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java
    poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSlideShowDumper.java
    poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java
    poi/trunk/poi/src/test/java/org/apache/poi/util/TestIOUtils.java

Modified: poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java?rev=1888792&r1=1888791&r2=1888792&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java (original)
+++ poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java Thu Apr 15 14:25:44 2021
@@ -21,7 +21,6 @@ import static org.junit.jupiter.api.Asse
 
 import java.io.File;
 import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -38,10 +37,12 @@ import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.NullPrintStream;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.parallel.Isolated;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
 import org.junit.jupiter.params.provider.MethodSource;
 
+@Isolated	// this test changes global static BYTE_ARRAY_MAX_OVERRIDE
 public abstract class BaseTestPPTIterating {
     protected static final Set<String> OLD_FILES = new HashSet<>();
     static {
@@ -76,7 +77,7 @@ public abstract class BaseTestPPTIterati
     private final PrintStream save = System.out;
 
     @BeforeEach
-    void setUpBase() throws UnsupportedEncodingException {
+    void setUpBase() {
         // set a higher max allocation limit as some test-files require more
         IOUtils.setByteArrayMaxOverride(5*1024*1024);
 

Modified: poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSlideShowDumper.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSlideShowDumper.java?rev=1888792&r1=1888791&r2=1888792&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSlideShowDumper.java (original)
+++ poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSlideShowDumper.java Thu Apr 15 14:25:44 2021
@@ -29,7 +29,9 @@ import org.apache.poi.EmptyFileException
 import org.apache.poi.hslf.HSLFTestDataSamples;
 import org.apache.poi.util.IOUtils;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Isolated;
 
+@Isolated	// this test changes global static BYTE_ARRAY_MAX_OVERRIDE
 public class TestSlideShowDumper extends BaseTestPPTIterating {
     private static final Set<String> FAILING = new HashSet<>();
     static {

Modified: poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java?rev=1888792&r1=1888791&r2=1888792&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java Thu Apr 15 14:25:44 2021
@@ -526,7 +526,7 @@ public final class IOUtils {
 
     private static void throwRFE(long length, int maxLength) {
         throw new RecordFormatException(String.format(Locale.ROOT, "Tried to allocate an array of length %,d" +
-                ", but the maximum lenght for this record type is %,d.\n" +
+                ", but the maximum length for this record type is %,d.\n" +
                 "If the file is not corrupt, please open an issue on bugzilla to request \n" +
                 "increasing the maximum allowable size for this record type.\n"+
                 "As a temporary workaround, consider setting a higher override value with " +

Modified: poi/trunk/poi/src/test/java/org/apache/poi/util/TestIOUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java/org/apache/poi/util/TestIOUtils.java?rev=1888792&r1=1888791&r2=1888792&view=diff
==============================================================================
--- poi/trunk/poi/src/test/java/org/apache/poi/util/TestIOUtils.java (original)
+++ poi/trunk/poi/src/test/java/org/apache/poi/util/TestIOUtils.java Thu Apr 15 14:25:44 2021
@@ -43,7 +43,9 @@ import org.apache.poi.EmptyFileException
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Isolated;
 
+@Isolated	// this test changes global static BYTE_ARRAY_MAX_OVERRIDE
 final class TestIOUtils {
     private static File TMP;
     private static final long LENGTH = 300 + new Random().nextInt(9000);
@@ -531,7 +533,7 @@ final class TestIOUtils {
         }
     }
 
-    public class NullInputStream extends InputStream {
+    public static class NullInputStream extends InputStream {
         private final int bytes;
         private final boolean exception;
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org