summaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/common/Debug.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-13 06:35:51 +0100
committerSven Gothel <[email protected]>2012-03-13 06:35:51 +0100
commitbab77b637e7cdd327de5f66989fcbfc0298b9b88 (patch)
tree3659baafc4f0eb84013b14cbd99efa1d7154b759 /src/java/jogamp/common/Debug.java
parent8d5786376337bcd40095c5a4d13e40696021e311 (diff)
Intro.: PropertyAccess ; Added safe PropertyAccess for JNILibLoaderBase, Platform, IOUtil, ..
- Intro.: PropertyAccess - Base class of all Debug impl, reduces redundancies. - jnlpAlias'ed trusted property is queried within local AccessControlContext to avoid 'JRE' implementation differences (should not be required). - throw NPE and IllegalArgumentException for invalid property key - Added safe PropertyAccess - JNILibLoaderBase: sun.jnlp.applet.launcher - Platform: jogamp.gluegen.UseTempJarCache - IOUtil: java.io.tmpdir
Diffstat (limited to 'src/java/jogamp/common/Debug.java')
-rw-r--r--src/java/jogamp/common/Debug.java73
1 files changed, 1 insertions, 72 deletions
diff --git a/src/java/jogamp/common/Debug.java b/src/java/jogamp/common/Debug.java
index cf07255..b8ed098 100644
--- a/src/java/jogamp/common/Debug.java
+++ b/src/java/jogamp/common/Debug.java
@@ -43,7 +43,7 @@ import java.security.*;
/** 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;
@@ -59,89 +59,18 @@ public class Debug {
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) {
- return Boolean.valueOf(Debug.getProperty(property, jnlpAlias, acc)).booleanValue();
- }
-
- public static boolean getBooleanProperty(boolean defaultValue, final String property, final boolean jnlpAlias, final AccessControlContext acc) {
- final String valueS = Debug.getProperty(property, jnlpAlias, acc);
- if(null != valueS) {
- return Boolean.valueOf(Debug.getProperty(property, jnlpAlias, acc)).booleanValue();
- }
- return defaultValue;
- }
-
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 = AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String 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;
}