aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-07-17 04:27:13 +0200
committerSven Gothel <[email protected]>2013-07-17 04:27:13 +0200
commit8ac3f344aded383ca9a3083a877af7bfdf6e1e48 (patch)
tree578fe88bbf8519aed9ef0cf255acd2a7d22a0978 /src/nativewindow
parenta3d5a805751f1cb2c12c80fb0c28db13945a0a2b (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/nativewindow')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java7
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/Debug.java9
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java3
3 files changed, 14 insertions, 5 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
index 744c7e6d5..4f07bca9b 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
@@ -66,8 +66,13 @@ import jogamp.nativewindow.Debug;
*/
public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
- private static final boolean DEBUG = Debug.isPropertyDefined("nativewindow.debug.CapabilitiesChooser", true);
+ private static final boolean DEBUG;
+ static {
+ Debug.initSingleton();
+ DEBUG = Debug.isPropertyDefined("nativewindow.debug.CapabilitiesChooser", true);
+ }
+
private final static int NO_SCORE = -9999999;
private final static int COLOR_MISMATCH_PENALTY_SCALE = 36;
diff --git a/src/nativewindow/classes/jogamp/nativewindow/Debug.java b/src/nativewindow/classes/jogamp/nativewindow/Debug.java
index 95547c971..c5e316364 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/Debug.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/Debug.java
@@ -69,15 +69,18 @@ public class Debug extends PropertyAccess {
}
}
- public static boolean verbose() {
+ /** Ensures static init block has been issues, i.e. if calling through to {@link PropertyAccess#isPropertyDefined(String, boolean)}. */
+ public static final void initSingleton() {}
+
+ public static final boolean verbose() {
return verbose;
}
- public static boolean debugAll() {
+ public static final boolean debugAll() {
return debugAll;
}
- public static boolean debug(String subcomponent) {
+ public static final boolean debug(String subcomponent) {
return debugAll() || isPropertyDefined("nativewindow.debug." + subcomponent, true);
}
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
index bbc58b73a..78e432b7f 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
@@ -53,6 +53,8 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice;
* Contains a thread safe X11 utility to retrieve display connections.
*/
public class X11Util implements ToolkitProperties {
+ public static final boolean DEBUG = Debug.debug("X11Util");
+
/**
* See Bug 515 - https://jogamp.org/bugzilla/show_bug.cgi?id=515
* <p>
@@ -92,7 +94,6 @@ public class X11Util implements ToolkitProperties {
*/
public static final boolean ATI_HAS_MULTITHREADING_BUG = !Debug.isPropertyDefined("nativewindow.debug.X11Util.ATI_HAS_NO_MULTITHREADING_BUG", true);
- public static final boolean DEBUG = Debug.debug("X11Util");
public static final boolean XSYNC_ENABLED = Debug.isPropertyDefined("nativewindow.debug.X11Util.XSync", true);
public static final boolean XERROR_STACKDUMP = DEBUG || Debug.isPropertyDefined("nativewindow.debug.X11Util.XErrorStackDump", true);
private static final boolean TRACE_DISPLAY_LIFECYCLE = Debug.isPropertyDefined("nativewindow.debug.X11Util.TraceDisplayLifecycle", true);