diff options
author | Sven Gothel <[email protected]> | 2012-03-13 19:58:13 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-03-13 19:58:13 +0100 |
commit | bb177035f42c650f1f66ed172efc65c34b180c31 (patch) | |
tree | 4059512d3d3885aae5df1c2281c7374b2b99f27f /src/java/jogamp/openal | |
parent | 00d520eae5b8a6dc455690f2e371d074b7da3145 (diff) |
Adapt to gluegen commit f4ac27e177f6deb444280d3b375e7d343e38bd080 (Properties/Security)
Diffstat (limited to 'src/java/jogamp/openal')
-rw-r--r-- | src/java/jogamp/openal/Debug.java | 88 |
1 files changed, 4 insertions, 84 deletions
diff --git a/src/java/jogamp/openal/Debug.java b/src/java/jogamp/openal/Debug.java index 671aeec..e157f00 100644 --- a/src/java/jogamp/openal/Debug.java +++ b/src/java/jogamp/openal/Debug.java @@ -39,102 +39,22 @@ package jogamp.openal; -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; static { - localACC=AccessController.getContext(); + PropertyAccess.addTrustedPrefix("joal.", Debug.class); verbose = isPropertyDefined("joal.verbose", true); debugAll = isPropertyDefined("joal.debug", true); } - static int getIntProperty(final String property, final boolean jnlpAlias) { - return getIntProperty(property, jnlpAlias, localACC, 0); - } - - public static int getIntProperty(final String property, final boolean jnlpAlias, final AccessControlContext acc, int defaultValue) { - int i=defaultValue; - try { - String sv = Debug.getProperty(property, jnlpAlias, acc); - if(null!=sv) { - Integer iv = Integer.valueOf(sv); - i = iv.intValue(); - } - } catch (NumberFormatException nfe) {} - return i; - } - - public static long getLongProperty(final String property, final boolean jnlpAlias, final AccessControlContext acc, long defaultValue) { - long l=defaultValue; - try { - String sv = Debug.getProperty(property, jnlpAlias, acc); - if(null!=sv) { - Long lv = Long.valueOf(sv); - l = lv.longValue(); - } - } catch (NumberFormatException nfe) {} - return l; - } - - 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(); - } - - static boolean isPropertyDefined(final String property, final boolean jnlpAlias) { - return isPropertyDefined(property, jnlpAlias, localACC); - } - - 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; } |