[libbluray-devel] [Git][videolan/libbluray][master] bdj: Fix JVM bootstrap issues with some Java 9 versions

Petri Hintukainen gitlab at videolan.org
Thu Jul 23 18:19:33 CEST 2020



Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
8fe24015 by hpi1 at 2020-07-23T19:19:23+03:00
bdj: Fix JVM bootstrap issues with some Java 9 versions

Fixes #22

- - - - -


1 changed file:

- src/libbluray/bdj/java/java/io/BDFileSystem.java


Changes:

=====================================
src/libbluray/bdj/java/java/io/BDFileSystem.java
=====================================
@@ -51,6 +51,26 @@ public abstract class BDFileSystem extends FileSystem {
 
     static {
         try {
+            /* Workaround for Java 9 bootstrap issues:
+             * In some Java 9 versions this methods is called in VM init phase1
+             * before setJavaLangAccess() -> getDeclaredMethod() crashes in StringJoiner
+             */
+            String v = System.getProperty("java.version");
+            int i = 0;
+            if (v.startsWith("1."))
+                v = v.substring(2, 3);
+            if (v.indexOf(".") != -1)
+                v = v.substring(0, v.indexOf("."));
+            if (v.indexOf("-") != -1)
+                v = v.substring(0, v.indexOf("-"));
+            try {
+                i = Integer.parseInt(v);
+            } catch (Throwable t) {
+                i = 0;
+            }
+            if (i >= 8)
+                throw new Exception("java>7");
+
             /* Java < 8 */
             nativeFileSystem = (FileSystem)FileSystem.class
                 .getDeclaredMethod("getFileSystem",new Class[0])



View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/8fe240150041ce02173f193b5a909d79fa0ab983

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/8fe240150041ce02173f193b5a909d79fa0ab983
You're receiving this email because of your account on code.videolan.org.




More information about the libbluray-devel mailing list