diff options
author | Sven Gothel <[email protected]> | 2010-04-28 07:04:33 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-04-28 07:04:33 +0200 |
commit | 3216f5b75879e0706b3e3e7cedbcbf56da95989e (patch) | |
tree | 0c0ab772c1d2a9cabbdc7ad23a5552f21ea86e33 /src/java/com/jogamp/common | |
parent | e162d985bdf397514e587074b8bdcc58ce2dcaa4 (diff) |
Fix privileged access (applet)
Diffstat (limited to 'src/java/com/jogamp/common')
-rw-r--r-- | src/java/com/jogamp/common/os/Platform.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java index 169af13..b6298a7 100644 --- a/src/java/com/jogamp/common/os/Platform.java +++ b/src/java/com/jogamp/common/os/Platform.java @@ -34,6 +34,7 @@ import com.jogamp.common.nio.Buffers; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; +import java.security.*; /** * Utility class for querying platform specific properties. @@ -93,17 +94,23 @@ public class Platform { } } - // fast path - boolean se = System.getProperty("java.runtime.name").indexOf("Java SE") != -1; + boolean se; + try{ + Class.forName("java.nio.LongBuffer"); + Class.forName("java.nio.DoubleBuffer"); + se = true; + }catch(ClassNotFoundException ex) { + se = false; + } if(!se) { - try{ - Class.forName("java.nio.LongBuffer"); - Class.forName("java.nio.DoubleBuffer"); - se = true; - }catch(ClassNotFoundException ex) { - se = false; - } + // 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"); + } + }); + se = java_runtime_name.indexOf("Java SE") != -1; } JAVA_SE = se; |