diff options
author | Sven Gothel <[email protected]> | 2010-07-08 18:11:57 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-07-08 18:11:57 +0200 |
commit | aab11cbb94f356dcc0b370089c5b8bb3eb6ea0e6 (patch) | |
tree | 43c75afafaa9ed36089367e40940ba58cb15e4ba /src | |
parent | 5b6ecb0854825a624f82e63f3180c2e85d905f0f (diff) |
Final fix for Java SE Platform query, as negotiated with Michael :)
Diffstat (limited to 'src')
-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; } |