summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-13 20:19:19 +0100
committerSven Gothel <[email protected]>2012-03-13 20:19:19 +0100
commit7d7e7c901d8fe54af1230cbf10e568f1a8433cbe (patch)
treefe878a3776be351faa3c3f7f10583af5f38c112d /src/newt
parent558a674f5ed727be1536cffd882d43458ce47a37 (diff)
Adapt to gluegen Properties/Security commits f4ac27e177f6deb444280d3b375e7d343e38bd080 and eedb4b530fb83fc59a26962bcf7847a1404092a0
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/util/MainThread.java5
-rw-r--r--src/newt/classes/jogamp/newt/Debug.java82
-rw-r--r--src/newt/classes/jogamp/newt/ScreenImpl.java7
3 files changed, 18 insertions, 76 deletions
diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java
index e71ef75ec..3b5e3a6fb 100644
--- a/src/newt/classes/com/jogamp/newt/util/MainThread.java
+++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java
@@ -39,8 +39,6 @@ package com.jogamp.newt.util;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
-import java.security.AccessControlContext;
-import java.security.AccessController;
import javax.media.nativewindow.NativeWindowFactory;
@@ -101,11 +99,10 @@ public class MainThread {
public static final boolean HINT_USE_MAIN_THREAD;
static {
- final AccessControlContext localACC = AccessController.getContext();
NativeWindowFactory.initSingleton(true);
NEWTJNILibLoader.loadNEWT();
HINT_USE_MAIN_THREAD = !NativeWindowFactory.isAWTAvailable() ||
- Debug.getBooleanProperty("newt.MainThread.force", true, localACC);
+ Debug.getBooleanProperty("newt.MainThread.force", true);
osType = Platform.getOSType();
isMacOSX = osType == Platform.OSType.MACOS;
}
diff --git a/src/newt/classes/jogamp/newt/Debug.java b/src/newt/classes/jogamp/newt/Debug.java
index 85fbbe764..3c83da4d9 100644
--- a/src/newt/classes/jogamp/newt/Debug.java
+++ b/src/newt/classes/jogamp/newt/Debug.java
@@ -39,18 +39,17 @@
package jogamp.newt;
-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("newt.", Debug.class);
verbose = isPropertyDefined("newt.verbose", true);
debugAll = isPropertyDefined("newt.debug", true);
if (verbose) {
@@ -61,71 +60,18 @@ public class Debug {
}
}
- static int getIntProperty(final String property, final boolean jnlpAlias) {
- return getIntProperty(property, jnlpAlias, localACC);
+ public static final boolean isPropertyDefined(final String property, final boolean jnlpAlias) {
+ return PropertyAccess.isPropertyDefined(property, jnlpAlias, null);
}
-
- 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 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 final int getIntProperty(final String property, final boolean jnlpAlias, int defaultValue) {
+ return PropertyAccess.getIntProperty(property, jnlpAlias, null, defaultValue);
}
-
- 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 boolean getBooleanProperty(final String property, final boolean jnlpAlias) {
+ return PropertyAccess.getBooleanProperty(property, jnlpAlias, null);
}
- public static final String jnlp_prefix = "jnlp." ;
-
+
public static boolean verbose() {
return verbose;
}
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java
index d4c6b6ee0..72f1b5a2c 100644
--- a/src/newt/classes/jogamp/newt/ScreenImpl.java
+++ b/src/newt/classes/jogamp/newt/ScreenImpl.java
@@ -34,7 +34,6 @@
package jogamp.newt;
-import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
@@ -49,6 +48,7 @@ import javax.media.nativewindow.util.DimensionImmutable;
import javax.media.nativewindow.util.Point;
import javax.media.nativewindow.util.SurfaceSize;
+
import com.jogamp.common.util.ArrayHashSet;
import com.jogamp.common.util.IntIntHashMap;
import com.jogamp.newt.Display;
@@ -78,7 +78,6 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
protected Dimension vSize = new Dimension(0, 0); // virtual rotated screen size
protected static Dimension usrSize = null; // property values: newt.ws.swidth and newt.ws.sheight
protected static volatile boolean usrSizeQueried = false;
- private static AccessControlContext localACC = AccessController.getContext();
private ArrayList<ScreenModeListener> referencedScreenModeListener = new ArrayList<ScreenModeListener>();
private long tCreated; // creationTime
@@ -121,8 +120,8 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
synchronized (Screen.class) {
if(!usrSizeQueried) {
usrSizeQueried = true;
- final int w = Debug.getIntProperty("newt.ws.swidth", true, localACC);
- final int h = Debug.getIntProperty("newt.ws.sheight", true, localACC);
+ final int w = Debug.getIntProperty("newt.ws.swidth", true, 0);
+ final int h = Debug.getIntProperty("newt.ws.sheight", true, 0);
if(w>0 && h>0) {
usrSize = new Dimension(w, h);
System.err.println("User screen size "+usrSize);