summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/sun/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-07-03 23:31:02 +0000
committerSven Gothel <[email protected]>2009-07-03 23:31:02 +0000
commit944a0ca587d20d193b9f8c7b5edbd0b0bd0d7666 (patch)
tree61473a7a57d71427ce8fdf927eefc74130e093bb /src/jogl/classes/com/sun/opengl
parent02ccc7939e2c542860f154e4f9063dbb1839a893 (diff)
Fix property query. Thx to Ken pointing this out.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@2018 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/jogl/classes/com/sun/opengl')
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/Debug.java71
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java2
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/util/texture/Texture.java7
6 files changed, 62 insertions, 24 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());
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/Texture.java b/src/jogl/classes/com/sun/opengl/util/texture/Texture.java
index c8dda5ed5..87f045a6d 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/Texture.java
+++ b/src/jogl/classes/com/sun/opengl/util/texture/Texture.java
@@ -37,6 +37,7 @@
package com.sun.opengl.util.texture;
import java.nio.*;
+import java.security.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
@@ -168,12 +169,14 @@ public class Texture {
/** An estimate of the amount of texture memory this texture consumes. */
private int estimatedMemorySize;
+ private static final AccessControlContext localACC = AccessController.getContext();
+
private static final boolean DEBUG = Debug.debug("Texture");
private static final boolean VERBOSE = Debug.verbose();
// For testing alternate code paths on more capable hardware
- private static final boolean disableNPOT = Debug.isPropertyDefined("jogl.texture.nonpot");
- private static final boolean disableTexRect = Debug.isPropertyDefined("jogl.texture.notexrect");
+ private static final boolean disableNPOT = Debug.isPropertyDefined("jogl.texture.nonpot", true, localACC);
+ private static final boolean disableTexRect = Debug.isPropertyDefined("jogl.texture.notexrect", true, localACC);
public Texture(TextureData data) throws GLException {
GL gl = GLContext.getCurrentGL();