diff options
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl')
5 files changed, 57 insertions, 22 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/Debug.java b/src/jogl/classes/com/sun/opengl/impl/Debug.java index b34b8e108..b6c6e6a00 100644 --- a/src/jogl/classes/com/sun/opengl/impl/Debug.java +++ b/src/jogl/classes/com/sun/opengl/impl/Debug.java @@ -47,10 +47,12 @@ public class Debug { // Some common properties private static boolean verbose; private static boolean debugAll; + private static AccessControlContext localACC; static { - verbose = isPropertyDefined("jogl.verbose"); - debugAll = isPropertyDefined("jogl.debug"); + localACC=AccessController.getContext(); + verbose = isPropertyDefined("jogl.verbose", true); + debugAll = isPropertyDefined("jogl.debug", true); if (verbose) { Package p = Package.getPackage("javax.media.opengl"); System.err.println("JOGL specification version " + p.getSpecificationVersion()); @@ -59,34 +61,67 @@ public class Debug { } } - public static int getIntProperty(final String property, final boolean jnlpAlias) { + protected static int getIntProperty(final String property, final boolean jnlpAlias) { + return getIntProperty(property, jnlpAlias, localACC); + } + + public static int getIntProperty(final String property, final boolean jnlpAlias, final AccessControlContext acc) { int i=0; try { - Integer iv = Integer.valueOf(Debug.getProperty(property, jnlpAlias)); + Integer iv = Integer.valueOf(Debug.getProperty(property, jnlpAlias, acc)); i = iv.intValue(); } catch (NumberFormatException nfe) {} return i; } - public static boolean getBooleanProperty(final String property, final boolean jnlpAlias) { - Boolean b = Boolean.valueOf(Debug.getProperty(property, jnlpAlias)); + protected static boolean getBooleanProperty(final String property, final boolean jnlpAlias) { + return getBooleanProperty(property, jnlpAlias, localACC); + } + + public static boolean getBooleanProperty(final String property, final boolean jnlpAlias, final AccessControlContext acc) { + Boolean b = Boolean.valueOf(Debug.getProperty(property, jnlpAlias, acc)); return b.booleanValue(); } - public static boolean isPropertyDefined(final String property) { - return (Debug.getProperty(property, true) != null) ? true : false; + protected static boolean isPropertyDefined(final String property, final boolean jnlpAlias) { + return isPropertyDefined(property, jnlpAlias, localACC); } - public static String getProperty(final String property, final boolean jnlpAlias) { - String s = (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String val = System.getProperty(property); - if(null==val && jnlpAlias && !property.startsWith(jnlp_prefix)) { - val = System.getProperty(jnlp_prefix + property); - } - return val; + public static boolean isPropertyDefined(final String property, final boolean jnlpAlias, final AccessControlContext acc) { + return (Debug.getProperty(property, jnlpAlias, acc) != null) ? true : false; + } + + protected static String getProperty(final String property, final boolean jnlpAlias) { + return getProperty(property, jnlpAlias, localACC); + } + + public static String getProperty(final String property, final boolean jnlpAlias, final AccessControlContext acc) { + String s=null; + if(null!=acc && acc.equals(localACC)) { + s = (String) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String val=null; + try { + val = System.getProperty(property); + } catch (Exception e) {} + if(null==val && jnlpAlias && !property.startsWith(jnlp_prefix)) { + try { + val = System.getProperty(jnlp_prefix + property); + } catch (Exception e) {} + } + return val; + } + }); + } else { + try { + s = System.getProperty(property); + } catch (Exception e) {} + if(null==s && jnlpAlias && !property.startsWith(jnlp_prefix)) { + try { + s = System.getProperty(jnlp_prefix + property); + } catch (Exception e) {} } - }); + } return s; } public static final String jnlp_prefix = "jnlp." ; @@ -100,6 +135,6 @@ public class Debug { } public static boolean debug(String subcomponent) { - return debugAll() || isPropertyDefined("jogl.debug." + subcomponent); + return debugAll() || isPropertyDefined("jogl.debug." + subcomponent, true); } } diff --git a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java index 63dba3ff0..eee308088 100644 --- a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java +++ b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java @@ -52,7 +52,7 @@ import java.lang.reflect.*; */ public final class ExtensionAvailabilityCache { private static final boolean DEBUG = Debug.debug("ExtensionAvailabilityCache"); - private static final boolean DEBUG_AVAILABILITY = Debug.isPropertyDefined("ExtensionAvailabilityCache"); + private static final boolean DEBUG_AVAILABILITY = Debug.isPropertyDefined("ExtensionAvailabilityCache", true); ExtensionAvailabilityCache(GLContextImpl context) { diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java index da0d96396..c60cccec6 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java @@ -60,7 +60,7 @@ public abstract class GLContextImpl extends GLContext { // basically had no tangible effect on the Windows or Mac OS X // platforms anyway in particular with the disabling of the // GLWorkerThread which we found to be necessary in 1.0 beta 4. - protected boolean optimizationEnabled = Debug.isPropertyDefined("jogl.GLContext.optimize"); + protected boolean optimizationEnabled = Debug.isPropertyDefined("jogl.GLContext.optimize", true); // Cache of the functions that are available to be called at the current // moment in time diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java index 95c868d00..d6ca2cbf5 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java @@ -49,7 +49,7 @@ public class GLDrawableHelper { private volatile List listeners = new ArrayList(); private static final boolean DEBUG = Debug.debug("GLDrawableHelper"); private static final boolean VERBOSE = Debug.verbose(); - private static final boolean NVIDIA_CRASH_WORKAROUND = Debug.isPropertyDefined("jogl.nvidia.crash.workaround"); + private static final boolean NVIDIA_CRASH_WORKAROUND = Debug.isPropertyDefined("jogl.nvidia.crash.workaround", true); private boolean autoSwapBufferMode = true; public GLDrawableHelper() { diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java index 33fdea384..d702150d3 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -17,7 +17,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { private static boolean isTigerOrLater; static { - String osVersion = Debug.getProperty("os.version", false); + String osVersion = Debug.getProperty("os.version", false, AccessController.getContext()); StringTokenizer tok = new StringTokenizer(osVersion, ". "); int major = Integer.parseInt(tok.nextToken()); int minor = Integer.parseInt(tok.nextToken()); |