diff options
author | Sven Gothel <[email protected]> | 2013-07-17 04:21:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-07-17 04:21:29 +0200 |
commit | d27d802b4e11745969909229a2d1f0963c74ce3a (patch) | |
tree | 30b4c51184e95af6822753e00b544fe986a1b0dc /src/java/jogamp/common/Debug.java | |
parent | af1f56c6f4a962720f5d63397e65505a29d6b0cb (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/java/jogamp/common/Debug.java')
-rw-r--r-- | src/java/jogamp/common/Debug.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/java/jogamp/common/Debug.java b/src/java/jogamp/common/Debug.java index b8a32d8..b826a06 100644 --- a/src/java/jogamp/common/Debug.java +++ b/src/java/jogamp/common/Debug.java @@ -63,15 +63,18 @@ public class Debug extends PropertyAccess { debugAll = isPropertyDefined("jogamp.debug", true); } - 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("jogamp.debug." + subcomponent, true); } } |