]> source.dussan.org Git - poi.git/commitdiff
integration tests: Fix JDK version handling
authorAndreas Beeker <kiwiwings@apache.org>
Sat, 16 Jan 2021 11:36:45 +0000 (11:36 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Sat, 16 Jan 2021 11:36:45 +0000 (11:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885553 13f79535-47bb-0310-9956-ffa450edef68

src/integrationtest/org/apache/poi/stress/TestAllFiles.java

index 347559330f9281d159fa6b642edc156c59883c45..a065309fc6392d9c2507a335de2e141cb6e9022d 100644 (file)
@@ -88,15 +88,8 @@ import org.opentest4j.AssertionFailedError;
 @Execution(ExecutionMode.CONCURRENT)
 public class TestAllFiles {
     private static final File ROOT_DIR = new File("test-data");
-    private static final int jreVersion;
-
-    static {
-        String version = System.getProperty("java.version");
-        String major = version.startsWith("1.")
-            ? version.substring(2, 3)
-            : version.substring(0, version.indexOf("."));
-        jreVersion = Integer.parseInt(major);
-    }
+    private static final int jreVersion =
+        Integer.parseInt(System.getProperty("java.version").replaceAll("^(?:1\\.)?(\\d+).*", "$1"));
 
     public static final String[] SCAN_EXCLUDES = {
         "**/.svn/**",