Do not disable all files for poi-integration in build.gradle

It seems doing it this way can kick in even when using JDK 11+ due 
to the Gradle toolchain.

Let's rather do a more specific exclusion in code to only exclude files
which actually cause JDK 8 to hang.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911562 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2023-08-09 05:44:01 +00:00
parent e706f37170
commit 543d6ad54b
2 changed files with 12 additions and 3 deletions

View File

@ -139,9 +139,6 @@ artifacts {
test { test {
// exclude these from the normal test-run // exclude these from the normal test-run
exclude '**/*FileHandler.class' exclude '**/*FileHandler.class'
if (jdkVersion == 8) {
exclude '**/*.class'
}
dependsOn { testJar } dependsOn { testJar }

View File

@ -36,6 +36,7 @@ import java.util.stream.Stream;
import org.apache.poi.POIDataSamples; import org.apache.poi.POIDataSamples;
import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey; import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.function.Executable; import org.junit.jupiter.api.function.Executable;
import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode; import org.junit.jupiter.api.parallel.ExecutionMode;
@ -200,6 +201,13 @@ public class TestAllFiles {
String threadName = Thread.currentThread().getName(); String threadName = Thread.currentThread().getName();
try { try {
Thread.currentThread().setName("Handle - " + file + " - " + handler); Thread.currentThread().setName("Handle - " + file + " - " + handler);
// Some of the tests hang in JDK 8 due to Graphics-Rendering issues in JDK itself,
// therefore we do not run some tests here
Assumptions.assumeFalse(isJava8() && (
file.endsWith("23884_defense_FINAL_OOimport_edit.ppt")
), "Some files hang in JDK graphics rendering on Java 8 due to a JDK bug");
System.out.println("Running handleFiles on "+file); System.out.println("Running handleFiles on "+file);
FileHandler fileHandler = handler.getHandler(); FileHandler fileHandler = handler.getHandler();
assertNotNull(fileHandler, "Did not find a handler for file " + file); assertNotNull(fileHandler, "Did not find a handler for file " + file);
@ -301,4 +309,8 @@ public class TestAllFiles {
return msg; return msg;
} }
private static boolean isJava8() {
return System.getProperty("java.version").startsWith("1.8");
}
} }