diff options
author | Sven Gothel <[email protected]> | 2009-07-03 23:31:02 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-07-03 23:31:02 +0000 |
commit | 944a0ca587d20d193b9f8c7b5edbd0b0bd0d7666 (patch) | |
tree | 61473a7a57d71427ce8fdf927eefc74130e093bb /src | |
parent | 02ccc7939e2c542860f154e4f9063dbb1839a893 (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')
15 files changed, 188 insertions, 79 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(); diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java index f0450e89e..43347c416 100644 --- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java @@ -41,6 +41,7 @@ package javax.media.opengl; import javax.media.opengl.glu.*; import com.sun.opengl.impl.Debug; +import java.security.*; /** A higher-level abstraction than {@link GLDrawable} which supplies an event based mechanism ({@link GLEventListener}) for performing @@ -112,7 +113,7 @@ public interface GLAutoDrawable extends GLDrawable { /** Flag reflecting wheather the drawable reconfiguration will be issued in * case a screen device change occured, e.g. in a multihead environment, * where you drag the window to another monitor. */ - public static final boolean SCREEN_CHANGE_ACTION_ENABLED = Debug.getBooleanProperty("jogl.screenchange.action", true); + public static final boolean SCREEN_CHANGE_ACTION_ENABLED = Debug.getBooleanProperty("jogl.screenchange.action", true, AccessController.getContext()); /** FIXME: ** Invalid state, the resources are not yet ready to render. * diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index ef7fa8189..a2bff729a 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -56,8 +56,6 @@ import java.util.HashMap; refer to a given context. */ public abstract class GLContext { - protected static final boolean DEBUG = Debug.isPropertyDefined("jogl.debug.GLContext"); // Debug.debug("GLContext"); - /** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}. */ public static final int CONTEXT_NOT_CURRENT = 0; /** Indicates that the context was made current during the last call to {@link #makeCurrent makeCurrent}. */ @@ -180,11 +178,6 @@ public abstract class GLContext { * new GLContext implementations; not for use by end users. */ protected static void setCurrent(GLContext cur) { - if(DEBUG) { - Exception e = new Exception("setCurrent: "+Thread.currentThread()+", "+currentContext.get()+" -> "+cur); - e.printStackTrace(); - } - currentContext.set(cur); } diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 3724556db..d95d6d492 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -109,7 +109,7 @@ public abstract class GLDrawableFactory { String factoryClassName = null; tmp = null; try { - factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true); + factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true, AccessController.getContext()); if (null == factoryClassName) { if ( nativeOSType.equals(NativeWindowFactory.TYPE_EGL) ) { // use egl*Factory .. diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 5da6a892f..74da59cd3 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -110,20 +110,22 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { // Used by all backends either directly or indirectly to hook up callbacks private Updater updater = new Updater(); + private static final AccessControlContext localACC = AccessController.getContext(); + // Turns off the pbuffer-based backend (used by default, unless the // Java 2D / OpenGL pipeline is in use) private static boolean hardwareAccelerationDisabled = - Debug.isPropertyDefined("jogl.gljpanel.nohw"); + Debug.isPropertyDefined("jogl.gljpanel.nohw", true, localACC); // Turns off the fallback to software-based rendering from // pbuffer-based rendering private static boolean softwareRenderingDisabled = - Debug.isPropertyDefined("jogl.gljpanel.nosw"); + Debug.isPropertyDefined("jogl.gljpanel.nosw", true, localACC); // Indicates whether the Java 2D OpenGL pipeline is enabled private boolean oglPipelineEnabled = Java2D.isOGLPipelineActive() && - !Debug.isPropertyDefined("jogl.gljpanel.noogl"); + !Debug.isPropertyDefined("jogl.gljpanel.noogl", true, localACC); // For handling reshape events lazily private int reshapeX; diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/Debug.java b/src/nativewindow/classes/com/sun/nativewindow/impl/Debug.java index 7e7b81e8b..7b7785a7c 100644 --- a/src/nativewindow/classes/com/sun/nativewindow/impl/Debug.java +++ b/src/nativewindow/classes/com/sun/nativewindow/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("nativewindow.verbose"); - debugAll = isPropertyDefined("nativewindow.debug"); + localACC=AccessController.getContext(); + verbose = isPropertyDefined("nativewindow.verbose", true); + debugAll = isPropertyDefined("nativewindow.debug", true); if (verbose) { Package p = Package.getPackage("javax.media.nativewindow"); System.err.println("NativeWindow 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("nativewindow.debug." + subcomponent); + return debugAll() || isPropertyDefined("nativewindow.debug." + subcomponent, true); } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index 4f1323ff8..eb0c25aed 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -98,8 +98,9 @@ public abstract class NativeWindowFactory { JVMUtil.initSingleton(); // Gather the windowing OS first - nativeOSNamePure = Debug.getProperty("os.name", false); - nativeOSNameCustom = Debug.getProperty("nativewindow.ws.name", true); + AccessControlContext acc = AccessController.getContext(); + nativeOSNamePure = Debug.getProperty("os.name", false, acc); + nativeOSNameCustom = Debug.getProperty("nativewindow.ws.name", true, acc); if(null==nativeOSNameCustom||nativeOSNameCustom.length()==0) { nativeOSNameCustom = nativeOSNamePure; } @@ -127,8 +128,8 @@ public abstract class NativeWindowFactory { } catch (Exception e) { } } - boolean toolkitLockForced = Debug.getBooleanProperty("nativewindow.locking", true); - boolean awtToolkitLockDisabled = Debug.getBooleanProperty("java.awt.headless", false); + boolean toolkitLockForced = Debug.getBooleanProperty("nativewindow.locking", true, acc); + boolean awtToolkitLockDisabled = Debug.getBooleanProperty("java.awt.headless", false, acc); NativeWindowFactory _factory = null; diff --git a/src/newt/classes/com/sun/javafx/newt/Screen.java b/src/newt/classes/com/sun/javafx/newt/Screen.java index 4c184bc99..2566041a8 100755 --- a/src/newt/classes/com/sun/javafx/newt/Screen.java +++ b/src/newt/classes/com/sun/javafx/newt/Screen.java @@ -36,6 +36,7 @@ package com.sun.javafx.newt; import com.sun.javafx.newt.impl.*; import javax.media.nativewindow.*; +import java.security.*; public abstract class Screen { @@ -62,8 +63,8 @@ public abstract class Screen { protected static Screen create(String type, Display display, int idx) { try { if(usrWidth<0 || usrHeight<0) { - usrWidth = Debug.getIntProperty("newt.ws.swidth", true); - usrHeight = Debug.getIntProperty("newt.ws.sheight", true); + usrWidth = Debug.getIntProperty("newt.ws.swidth", true, localACC); + usrHeight = Debug.getIntProperty("newt.ws.sheight", true, localACC); System.out.println("User screen size "+usrWidth+"x"+usrHeight); } Class screenClass = getScreenClass(type); @@ -137,5 +138,6 @@ public abstract class Screen { protected AbstractGraphicsScreen aScreen; protected int width=-1, height=-1; // detected values: set using setScreenSize protected static int usrWidth=-1, usrHeight=-1; // property values: newt.ws.swidth and newt.ws.sheight + private static AccessControlContext localACC = AccessController.getContext(); } diff --git a/src/newt/classes/com/sun/javafx/newt/impl/Debug.java b/src/newt/classes/com/sun/javafx/newt/impl/Debug.java index 57ce88618..ed8531295 100644 --- a/src/newt/classes/com/sun/javafx/newt/impl/Debug.java +++ b/src/newt/classes/com/sun/javafx/newt/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("newt.verbose"); - debugAll = isPropertyDefined("newt.debug"); + localACC=AccessController.getContext(); + verbose = isPropertyDefined("newt.verbose", true); + debugAll = isPropertyDefined("newt.debug", true); if (verbose) { Package p = Package.getPackage("com.sun.javafx.newt"); System.err.println("NEWT 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("newt.debug." + subcomponent); + return debugAll() || isPropertyDefined("newt.debug." + subcomponent, true); } } diff --git a/src/newt/classes/com/sun/javafx/newt/util/MainThread.java b/src/newt/classes/com/sun/javafx/newt/util/MainThread.java index 3230f504b..abfe3f0c7 100644 --- a/src/newt/classes/com/sun/javafx/newt/util/MainThread.java +++ b/src/newt/classes/com/sun/javafx/newt/util/MainThread.java @@ -39,6 +39,7 @@ package com.sun.javafx.newt.util; import java.util.*; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; +import java.security.*; import javax.media.nativewindow.*; @@ -81,8 +82,9 @@ import com.sun.nativewindow.impl.NWReflection; * Which starts 4 threads, each with a window and OpenGL rendering.<br> */ public class MainThread { + private static AccessControlContext localACC = AccessController.getContext(); public static final boolean USE_MAIN_THREAD = NativeWindowFactory.TYPE_MACOSX.equals(NativeWindowFactory.getNativeWindowType(false)) || - Debug.getBooleanProperty("newt.MainThread.force", true); + Debug.getBooleanProperty("newt.MainThread.force", true, localACC); protected static final boolean DEBUG = Debug.debug("MainThread"); |