Bug 782

Summary: AccessControlException using jogl.debug.TextRenderer in applet
Product: [JogAmp] Jogl Reporter: martinezmj
Component: appletAssignee: Sven Gothel <sgothel>
Severity: major    
Priority: ---    
Version: 2   
Hardware: All   
OS: all   
Type: --- SCM Refs:
gluegen d27d802b4e11745969909229a2d1f0963c74ce3a joal b4fbbc98929c56b9f82815a50dacb02796d9d252 jogl 8ac3f344aded383ca9a3083a877af7bfdf6e1e48
Workaround: TRUE

Description martinezmj 2013-07-12 17:51:17 CEST
Any use of com.jogamp.opengl.util.awt.TextRenderer in an applet results in a AccessControlException when the TextRenderer class loads.

Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "jogl.debug.TextRenderer" "read")
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)
	at java.security.AccessController.checkPermission(AccessController.java:559)
	at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
	at sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1302)
	at java.lang.System.getProperty(System.java:707)
	at com.jogamp.common.util.PropertyAccess.getProperty(PropertyAccess.java:146)
	at com.jogamp.common.util.PropertyAccess.isPropertyDefined(PropertyAccess.java:109)
	at com.jogamp.opengl.util.awt.TextRenderer.<clinit>(TextRenderer.java:131)
	... 43 more

JOGL being loaded via http://jogamp.org/deployment/jogamp-current/jar/jogl-all.jar.  These results are for an unsigned applet. Setting property "jnlp.jogl.debug.TextRenderer" in the JNLP did not fix the issue.  I see the same issue in both Mac and Windows.

See this thread for more discussion of this issue:
Comment 1 Sven Gothel 2013-07-17 04:30:37 CEST
Calling 'Debug.isPropertyDefined(propName, default)' may be 'optimized' to
'PropertyAccess.isPropertyDefined(propName, default)', which would skip the modules Debug's class initialization.

Iff that happens, an AccessControlException may happen, due to requesting an insecure property,
since modules own Debug class has not been added it's trusted prefixes from within it's init block yet.

This seems to be a bug of the JVM .. to me, however .. the above description is the only
able to explain the issue at hand.

.. Naturally, Debug class should be initialized before calling it's parent isPropertyDefined(..)!
Comment 2 Sven Gothel 2013-07-17 04:33:09 CEST
Fix calls Debug class own static methods, either Debug.initSingleton() or Debug.debug(),
before calling 'isPropertyDefined(propName, default)'.


Also mark Debug class static methods final!


Marked as a workaround, since a JVM bug is assumed!