Skip to content

Commit

Permalink
Platform: Need priviledge read access for property 'java.awt.headless'
Browse files Browse the repository at this point in the history
  • Loading branch information
sgothel committed Apr 25, 2012
1 parent 3432d1d commit 993fedd
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/java/com/jogamp/common/os/Platform.java
Expand Up @@ -219,15 +219,19 @@ public enum ABIType {

{
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();
}
}

Expand Down

0 comments on commit 993fedd

Please sign in to comment.