diff options
Diffstat (limited to 'src/java/com/jogamp/common/os')
-rw-r--r-- | src/java/com/jogamp/common/os/Platform.java | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java index 2dc4532..62a95d7 100644 --- a/src/java/com/jogamp/common/os/Platform.java +++ b/src/java/com/jogamp/common/os/Platform.java @@ -106,14 +106,15 @@ public class Platform { } private static boolean initIsJavaSE() { - boolean javaSEChecked = false; - // fast path for desktop - if(System.getSecurityManager() == null) { - javaSEChecked = true; - if(System.getProperty("java.runtime.name").indexOf("Java SE") != -1) { - return true; + // the fast path, check property Java SE instead of traversing through the ClassLoader + String java_runtime_name = (String) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty("java.runtime.name"); } + }); + if(java_runtime_name.indexOf("Java SE") != -1) { + return true; } // probe for classes we need on a SE environment @@ -125,18 +126,6 @@ public class Platform { // continue with Java SE check } - if(!javaSEChecked) { - // no more the fast path, due to access controller .. - String java_runtime_name = (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - return System.getProperty("java.runtime.name"); - } - }); - if(java_runtime_name.indexOf("Java SE") != -1) { - return true; - } - } - return false; } |