[libbluray-devel] BDJSecurityManager: fix compatibility with Java < 8

hpi1 git at videolan.org
Mon May 23 19:05:05 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon May 23 19:58:18 2016 +0300| [4b5778957d33591502453488f068685b7959f5a8] | committer: hpi1

BDJSecurityManager: fix compatibility with Java < 8

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=4b5778957d33591502453488f068685b7959f5a8
---

 .../bdj/java/org/videolan/BDJSecurityManager.java          |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java b/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java
index 6b25ee1..522022f 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java
@@ -35,6 +35,15 @@ final class BDJSecurityManager extends SecurityManager {
     private String persistentRoot;
     private boolean usingUdf = false;
 
+    private static Class urlPermission = null;
+    static {
+        try {
+            /* Java 8 */
+            urlPermission = Class.forName("java.net.URLPermission");
+        } catch (Exception e) {
+        }
+    }
+
     BDJSecurityManager(String discRoot, String persistentRoot, String budaRoot) {
         this.discRoot  = discRoot;
         this.cacheRoot = null;
@@ -145,7 +154,8 @@ final class BDJSecurityManager extends SecurityManager {
                 return;
             }
         }
-        else if (perm instanceof java.net.URLPermission) {
+        else if (urlPermission != null &&
+                 urlPermission.isInstance(perm)) {
             logger.info("grant " + perm);
             return;
         }



More information about the libbluray-devel mailing list