aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util
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/com/jogamp/common/util
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/com/jogamp/common/util')
-rw-r--r--src/java/com/jogamp/common/util/IOUtil.java8
-rw-r--r--src/java/com/jogamp/common/util/locks/Lock.java6
2 files changed, 10 insertions, 4 deletions
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index 0463c37..cdbeab6 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -44,6 +44,7 @@ import java.net.URLConnection;
import java.nio.ByteBuffer;
import jogamp.common.Debug;
+import jogamp.common.PropertyAccess;
import jogamp.common.os.android.StaticContext;
import android.content.Context;
@@ -510,11 +511,14 @@ public class IOUtil {
* for both platforms w/o the need to handle extra permissions.
* </p>
*
+ * @throws SecurityException
+ * @throws RuntimeException
+ *
* @see StaticContext#setContext(Context)
* @see Context#getDir(String, int)
*/
public static File getTempRoot()
- throws SecurityException
+ throws SecurityException, RuntimeException
{
if(AndroidVersion.isAvailable) {
final Context ctx = StaticContext.getContext();
@@ -526,7 +530,7 @@ public class IOUtil {
return tmpRoot;
}
}
- final String tmpRootName = System.getProperty("java.io.tmpdir");
+ final String tmpRootName = PropertyAccess.getProperty("java.io.tmpdir", false, AccessController.getContext());
final File tmpRoot = new File(tmpRootName);
if(DEBUG) {
System.err.println("IOUtil.getTempRoot(isAndroid: "+AndroidVersion.isAvailable+"): temp dir: "+tmpRoot.getAbsolutePath());
diff --git a/src/java/com/jogamp/common/util/locks/Lock.java b/src/java/com/jogamp/common/util/locks/Lock.java
index 15d01ec..b2d6acc 100644
--- a/src/java/com/jogamp/common/util/locks/Lock.java
+++ b/src/java/com/jogamp/common/util/locks/Lock.java
@@ -29,6 +29,8 @@
package com.jogamp.common.util.locks;
import jogamp.common.Debug;
+import jogamp.common.PropertyAccess;
+
import java.security.AccessController;
/**
@@ -37,7 +39,7 @@ import java.security.AccessController;
public interface Lock {
/** Enable via the property <code>jogamp.debug.Lock.TraceLock</code> */
- public static final boolean TRACE_LOCK = Debug.isPropertyDefined("jogamp.debug.Lock.TraceLock", true, AccessController.getContext());
+ public static final boolean TRACE_LOCK = PropertyAccess.isPropertyDefined("jogamp.debug.Lock.TraceLock", true, AccessController.getContext());
/** Enable via the property <code>jogamp.debug.Lock</code> */
public static final boolean DEBUG = Debug.debug("Lock");
@@ -50,7 +52,7 @@ public interface Lock {
* and defaults to {@link #DEFAULT_TIMEOUT}.<br>
* It can be overridden via the system property <code>jogamp.common.utils.locks.Lock.timeout</code>.
*/
- public static final long TIMEOUT = Debug.getLongProperty("jogamp.common.utils.locks.Lock.timeout", true, AccessController.getContext(), DEFAULT_TIMEOUT);
+ public static final long TIMEOUT = PropertyAccess.getLongProperty("jogamp.common.utils.locks.Lock.timeout", true, AccessController.getContext(), DEFAULT_TIMEOUT);
/**
* Blocking until the lock is acquired by this Thread or {@link #TIMEOUT} is reached.