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/com/jogamp | |
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/com/jogamp')
-rw-r--r-- | src/java/com/jogamp/common/util/TaskBase.java | 7 | ||||
-rw-r--r-- | src/java/com/jogamp/common/util/locks/Lock.java | 6 | ||||
-rw-r--r-- | src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java | 7 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/java/com/jogamp/common/util/TaskBase.java b/src/java/com/jogamp/common/util/TaskBase.java index 9fd7c0d..35571e3 100644 --- a/src/java/com/jogamp/common/util/TaskBase.java +++ b/src/java/com/jogamp/common/util/TaskBase.java @@ -38,7 +38,12 @@ import jogamp.common.Debug; */ public abstract class TaskBase implements Runnable { /** Enable via the property <code>jogamp.debug.TaskBase.TraceSource</code> */ - private static final boolean TRACE_SOURCE = Debug.isPropertyDefined("jogamp.debug.TaskBase.TraceSource", true); + private static final boolean TRACE_SOURCE; + + static { + Debug.initSingleton(); + TRACE_SOURCE = Debug.isPropertyDefined("jogamp.debug.TaskBase.TraceSource", true); + } protected final Object syncObject; protected final boolean catchExceptions; diff --git a/src/java/com/jogamp/common/util/locks/Lock.java b/src/java/com/jogamp/common/util/locks/Lock.java index ea29763..df645ed 100644 --- a/src/java/com/jogamp/common/util/locks/Lock.java +++ b/src/java/com/jogamp/common/util/locks/Lock.java @@ -35,12 +35,12 @@ import jogamp.common.Debug; */ public interface Lock { - /** Enable via the property <code>jogamp.debug.Lock.TraceLock</code> */ - public static final boolean TRACE_LOCK = Debug.isPropertyDefined("jogamp.debug.Lock.TraceLock", true); - /** Enable via the property <code>jogamp.debug.Lock</code> */ public static final boolean DEBUG = Debug.debug("Lock"); + /** Enable via the property <code>jogamp.debug.Lock.TraceLock</code> */ + public static final boolean TRACE_LOCK = Debug.isPropertyDefined("jogamp.debug.Lock.TraceLock", true); + /** The default {@link #TIMEOUT} value, of {@value} ms */ public static final long DEFAULT_TIMEOUT = 5000; // 5s default timeout diff --git a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java index fc60265..841fa1d 100644 --- a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java +++ b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java @@ -80,8 +80,13 @@ import jogamp.common.Debug; @SupportedAnnotationTypes(value = {"com.jogamp.gluegen.structgen.CStruct"}) @SupportedSourceVersion(SourceVersion.RELEASE_6) public class CStructAnnotationProcessor extends AbstractProcessor { - private static final boolean DEBUG = Debug.isPropertyDefined("jogamp.gluegen.structgen.debug", true); private static final String DEFAULT = "_default_"; + private static final boolean DEBUG; + + static { + Debug.initSingleton(); + DEBUG = Debug.isPropertyDefined("jogamp.gluegen.structgen.debug", true); + } private static final String STRUCTGENOUTPUT_OPTION = "structgen.output"; private static final String STRUCTGENOUTPUT = PropertyAccess.getProperty("jogamp.gluegen."+STRUCTGENOUTPUT_OPTION, true, "gensrc"); |