diff options
author | Sven Gothel <[email protected]> | 2013-07-17 04:27:13 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-07-17 04:27:13 +0200 |
commit | 8ac3f344aded383ca9a3083a877af7bfdf6e1e48 (patch) | |
tree | 578fe88bbf8519aed9ef0cf255acd2a7d22a0978 /src/jogl/classes/javax | |
parent | a3d5a805751f1cb2c12c80fb0c28db13945a0a2b (diff) |
Remedy for Bug 782: Issue Debug.initSingleton() or Debug.debug(..) before calling 'PropertyAccess.isPropertyDefined(propName, default)' through Debug class.
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.
+++
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!
+++
Diffstat (limited to 'src/jogl/classes/javax')
3 files changed, 19 insertions, 8 deletions
diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java index b052769ca..b0f3da8e4 100644 --- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java +++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java @@ -85,8 +85,13 @@ import jogamp.opengl.Debug; */ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { - private static final boolean DEBUG = Debug.isPropertyDefined("jogl.debug.CapabilitiesChooser", true); + private static final boolean DEBUG; + static { + Debug.initSingleton(); + DEBUG = Debug.isPropertyDefined("jogl.debug.CapabilitiesChooser", true); + } + private final static int NO_SCORE = -9999999; private final static int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000; private final static int OPAQUE_MISMATCH_PENALTY = 750; diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index f36061c13..aa5fca2c2 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -73,6 +73,10 @@ import com.jogamp.opengl.GLRendererQuirks; refer to a given context. */ public abstract class GLContext { + public static final boolean DEBUG = Debug.debug("GLContext"); + public static final boolean TRACE_SWITCH = Debug.isPropertyDefined("jogl.debug.GLContext.TraceSwitch", true); + public static final boolean DEBUG_TRACE_SWITCH = DEBUG || TRACE_SWITCH; + /** * If <code>true</code> (default), bootstrapping the available GL profiles * will use the highest compatible GL context for each profile, @@ -102,10 +106,6 @@ public abstract class GLContext { protected static final boolean FORCE_NO_FBO_SUPPORT = Debug.isPropertyDefined("jogl.fbo.force.none", true); protected static final boolean FORCE_MIN_FBO_SUPPORT = Debug.isPropertyDefined("jogl.fbo.force.min", true); - public static final boolean DEBUG = Debug.debug("GLContext"); - public static final boolean TRACE_SWITCH = Debug.isPropertyDefined("jogl.debug.GLContext.TraceSwitch", true); - public static final boolean DEBUG_TRACE_SWITCH = DEBUG || TRACE_SWITCH; - /** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */ public static final boolean DEBUG_GL = Debug.isPropertyDefined("jogl.debug.DebugGL", true); /** Reflects property jogl.debug.TraceGL. If true, the trace pipeline is enabled at context creation. */ diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index d3f20b2e5..2a23defbe 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -138,9 +138,9 @@ import com.jogamp.opengl.util.awt.AWTGLPixelBuffer.SingleAWTGLPixelBufferProvide @SuppressWarnings("serial") public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosingProtocol { - private static final boolean DEBUG = Debug.debug("GLJPanel"); - private static final boolean DEBUG_VIEWPORT = Debug.isPropertyDefined("jogl.debug.GLJPanel.Viewport", true); - private static final boolean USE_GLSL_TEXTURE_RASTERIZER = !Debug.isPropertyDefined("jogl.gljpanel.noglsl", true); + private static final boolean DEBUG; + private static final boolean DEBUG_VIEWPORT; + private static final boolean USE_GLSL_TEXTURE_RASTERIZER; /** Indicates whether the Java 2D OpenGL pipeline is requested by user. */ private static final boolean java2dOGLEnabledByProp; @@ -152,11 +152,17 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private static boolean java2DGLPipelineOK; static { + Debug.initSingleton(); + DEBUG = Debug.debug("GLJPanel"); + DEBUG_VIEWPORT = Debug.isPropertyDefined("jogl.debug.GLJPanel.Viewport", true); + USE_GLSL_TEXTURE_RASTERIZER = !Debug.isPropertyDefined("jogl.gljpanel.noglsl", true); + boolean enabled = false; final String sVal = System.getProperty("sun.java2d.opengl"); if( null != sVal ) { enabled = Boolean.valueOf(sVal); } + Debug.initSingleton(); java2dOGLEnabledByProp = enabled && !Debug.isPropertyDefined("jogl.gljpanel.noogl", true); enabled = false; |