summaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorSven Gothel <sgothel@jausoft.com>2010-06-26 07:44:41 +0300
committerSven Gothel <sgothel@jausoft.com>2010-06-26 07:44:41 +0300
commit0b4366d8216254bbb6246be252c411a160e1b478 (patch)
treea8b08b57e63e07904c9888ce0c4c2e885ea6c78c /src/java
parentae37ac16a13aa62cd6e7a6ff0346403c5aa6b3e5 (diff)
Fix regression of missing JavaSE check in case of security manager; Typo
Diffstat (limited to 'src/java')
-rw-r--r--src/java/com/jogamp/common/os/Platform.java30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java
index 0d8b276..f31ca6c 100644
--- a/src/java/com/jogamp/common/os/Platform.java
+++ b/src/java/com/jogamp/common/os/Platform.java
@@ -60,14 +60,14 @@ public class Platform {
ARCH = System.getProperty("os.arch");
pointerSizeInBits = getPointerSizeInBitsImpl();
- is32Bit = initAch();
+ is32Bit = initArch();
JAVA_SE = initIsJavaSE();
LITTLE_ENDIAN = initByteOrder();
}
private Platform() {}
- private static boolean initAch() throws RuntimeException {
+ private static boolean initArch() throws RuntimeException {
// Try to use Sun's sun.ARCH.data.model first ..
if ( 32 == pointerSizeInBits || 64 == pointerSizeInBits ) {
return 32 == pointerSizeInBits;
@@ -104,10 +104,14 @@ public class Platform {
}
private static boolean initIsJavaSE() {
+ boolean javaSEChecked = false;
// fast path for desktop
- if(System.getSecurityManager() == null && System.getProperty("java.runtime.name").indexOf("Java SE") != -1) {
- return true;
+ if(System.getSecurityManager() == null) {
+ javaSEChecked = true;
+ if(System.getProperty("java.runtime.name").indexOf("Java SE") != -1) {
+ return true;
+ }
}
// probe for classes we need on a SE environment
@@ -115,9 +119,23 @@ public class Platform {
Class.forName("java.nio.LongBuffer");
Class.forName("java.nio.DoubleBuffer");
return true;
- }catch(ClassNotFoundException ex) {
- return false;
+ } catch(ClassNotFoundException ex) {
+ // 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;
}
private static boolean initByteOrder() {