diff options
author | Sven Gothel <[email protected]> | 2012-04-25 12:16:38 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-04-25 12:16:38 +0200 |
commit | 993fedde61c6fd5f38351b69c483a1bf8196bc99 (patch) | |
tree | ec2141e1bce1e5b8c8f4f091ab797ed4ade62f5d /src | |
parent | 3432d1de7ae83a19dec2eb6bcfc3b66be5ef83e2 (diff) |
Platform: Need priviledge read access for property 'java.awt.headless'
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/jogamp/common/os/Platform.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java index 461ed2a..fa565a0 100644 --- a/src/java/com/jogamp/common/os/Platform.java +++ b/src/java/com/jogamp/common/os/Platform.java @@ -219,15 +219,19 @@ public class Platform { { final ClassLoader cl = Platform.class.getClassLoader(); - boolean _AWT_AVAILABLE = false; - if( !Debug.getBooleanProperty("java.awt.headless", true) && - ReflectionUtil.isClassAvailable(ReflectionUtil.AWTNames.ComponentClass, cl) && - ReflectionUtil.isClassAvailable(ReflectionUtil.AWTNames.GraphicsEnvironmentClass, cl) ) { - try { - _AWT_AVAILABLE = false == ((Boolean)ReflectionUtil.callStaticMethod(ReflectionUtil.AWTNames.GraphicsEnvironmentClass, ReflectionUtil.AWTNames.isHeadlessMethod, null, null, cl)).booleanValue(); - } catch (Throwable t) { } - } - AWT_AVAILABLE = _AWT_AVAILABLE; + AWT_AVAILABLE = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { + public Boolean run() { + boolean awtAvailable = false; + if( !Debug.getBooleanProperty("java.awt.headless", true) && + ReflectionUtil.isClassAvailable(ReflectionUtil.AWTNames.ComponentClass, cl) && + ReflectionUtil.isClassAvailable(ReflectionUtil.AWTNames.GraphicsEnvironmentClass, cl) ) { + try { + awtAvailable = false == ((Boolean)ReflectionUtil.callStaticMethod(ReflectionUtil.AWTNames.GraphicsEnvironmentClass, ReflectionUtil.AWTNames.isHeadlessMethod, null, null, cl)).booleanValue(); + } catch (Throwable t) { } + } + return new Boolean(awtAvailable); + } + }).booleanValue(); } } |