diff options
author | Sven Gothel <[email protected]> | 2012-03-13 20:19:19 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-03-13 20:19:19 +0100 |
commit | 7d7e7c901d8fe54af1230cbf10e568f1a8433cbe (patch) | |
tree | fe878a3776be351faa3c3f7f10583af5f38c112d /src/nativewindow/classes/jogamp | |
parent | 558a674f5ed727be1536cffd882d43458ce47a37 (diff) |
Adapt to gluegen Properties/Security commits f4ac27e177f6deb444280d3b375e7d343e38bd080 and eedb4b530fb83fc59a26962bcf7847a1404092a0
Diffstat (limited to 'src/nativewindow/classes/jogamp')
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/Debug.java | 83 | ||||
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java | 3 |
2 files changed, 16 insertions, 70 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/Debug.java b/src/nativewindow/classes/jogamp/nativewindow/Debug.java index f1cd209dc..e07fd1b57 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/Debug.java +++ b/src/nativewindow/classes/jogamp/nativewindow/Debug.java @@ -39,18 +39,18 @@ package jogamp.nativewindow; -import java.security.*; +import com.jogamp.common.util.PropertyAccess; /** Helper routines for logging and debugging. */ -public class Debug { +public class Debug extends PropertyAccess { // Some common properties - private static boolean verbose; - private static boolean debugAll; - private static AccessControlContext localACC; + private static final boolean verbose; + private static final boolean debugAll; static { - localACC=AccessController.getContext(); + PropertyAccess.addTrustedPrefix("nativewindow.", Debug.class); + verbose = isPropertyDefined("nativewindow.verbose", true); debugAll = isPropertyDefined("nativewindow.debug", true); if (verbose) { @@ -61,71 +61,18 @@ public class Debug { } } - 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, acc)); - i = iv.intValue(); - } catch (NumberFormatException nfe) {} - return i; - } - - static boolean getBooleanProperty(final String property, final boolean jnlpAlias) { - return getBooleanProperty(property, jnlpAlias, localACC); + public static final boolean isPropertyDefined(final String property, final boolean jnlpAlias) { + return PropertyAccess.isPropertyDefined(property, jnlpAlias, null); } - - 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 String getProperty(final String property, final boolean jnlpAlias) { + return PropertyAccess.getProperty(property, jnlpAlias, null); } - - static boolean isPropertyDefined(final String property, final boolean jnlpAlias) { - return isPropertyDefined(property, jnlpAlias, localACC); + + public static final boolean getBooleanProperty(final String property, final boolean jnlpAlias) { + return PropertyAccess.getBooleanProperty(property, jnlpAlias, null); } - - public static boolean isPropertyDefined(final String property, final boolean jnlpAlias, final AccessControlContext acc) { - return (Debug.getProperty(property, jnlpAlias, acc) != null) ? true : false; - } - - 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." ; - + public static boolean verbose() { return verbose; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java index 4cbc1e367..c42bcf816 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java @@ -33,7 +33,6 @@ package jogamp.nativewindow.x11; -import java.security.AccessController; import java.util.ArrayList; import java.util.List; @@ -83,7 +82,7 @@ public class X11Util { public static final boolean HAS_XLOCKDISPLAY_BUG = true; private static final boolean DEBUG = Debug.debug("X11Util"); - private static final boolean TRACE_DISPLAY_LIFECYCLE = Debug.getBooleanProperty("nativewindow.debug.X11Util.TraceDisplayLifecycle", true, AccessController.getContext()); + private static final boolean TRACE_DISPLAY_LIFECYCLE = Debug.getBooleanProperty("nativewindow.debug.X11Util.TraceDisplayLifecycle", true); private static String nullDisplayName = null; private static boolean isX11LockAvailable = false; |