summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/common/util')
-rw-r--r--src/java/com/jogamp/common/util/IOUtil.java3
-rw-r--r--src/java/com/jogamp/common/util/IntIntHashMap.java5
-rw-r--r--src/java/com/jogamp/common/util/PropertyAccess.java2
-rw-r--r--src/java/com/jogamp/common/util/SecurityUtil.java27
-rw-r--r--src/java/com/jogamp/common/util/UnsafeUtil.java5
5 files changed, 29 insertions, 13 deletions
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index 380cb00..045525c 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -48,7 +48,6 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.ByteBuffer;
-import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.List;
@@ -79,7 +78,7 @@ public class IOUtil {
static {
final boolean _props[] = { false, false, false, false, false, false };
- final Method[] res = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
+ final Method[] res = SecurityUtil.doPrivileged(new PrivilegedAction<Method[]>() {
@Override
public Method[] run() {
final Method[] res = new Method[] { null, null };
diff --git a/src/java/com/jogamp/common/util/IntIntHashMap.java b/src/java/com/jogamp/common/util/IntIntHashMap.java
index f78b1e0..d74b79c 100644
--- a/src/java/com/jogamp/common/util/IntIntHashMap.java
+++ b/src/java/com/jogamp/common/util/IntIntHashMap.java
@@ -34,7 +34,6 @@ package com.jogamp.common.util;
import com.jogamp.common.JogampRuntimeException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
-import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Arrays;
@@ -84,7 +83,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
isPrimitive = valueClazz.isPrimitive();
if(!isPrimitive) {
- final EntryCM cm = AccessController.doPrivileged(new PrivilegedAction<EntryCM>() {
+ final EntryCM cm = SecurityUtil.doPrivileged(new PrivilegedAction<EntryCM>() {
@Override
@SuppressWarnings("unchecked")
public EntryCM run() {
@@ -502,7 +501,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
private static Method getCloneMethod(final Object obj) {
final Class<?> clazz = obj.getClass();
- return AccessController.doPrivileged(new PrivilegedAction<Method>() {
+ return SecurityUtil.doPrivileged(new PrivilegedAction<Method>() {
@Override
public Method run() {
try {
diff --git a/src/java/com/jogamp/common/util/PropertyAccess.java b/src/java/com/jogamp/common/util/PropertyAccess.java
index b6e9bdd..6dd550b 100644
--- a/src/java/com/jogamp/common/util/PropertyAccess.java
+++ b/src/java/com/jogamp/common/util/PropertyAccess.java
@@ -175,7 +175,7 @@ public class PropertyAccess {
}
private static final String getTrustedPropKey(final String propertyKey) {
- return AccessController.doPrivileged(new PrivilegedAction<String>() {
+ return SecurityUtil.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
try {
diff --git a/src/java/com/jogamp/common/util/SecurityUtil.java b/src/java/com/jogamp/common/util/SecurityUtil.java
index 1b8b7c2..9591f70 100644
--- a/src/java/com/jogamp/common/util/SecurityUtil.java
+++ b/src/java/com/jogamp/common/util/SecurityUtil.java
@@ -27,7 +27,6 @@
*/
package com.jogamp.common.util;
-import java.security.AccessController;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.Permission;
@@ -36,18 +35,38 @@ import java.security.ProtectionDomain;
import java.security.cert.Certificate;
public class SecurityUtil {
+ @SuppressWarnings("removal")
private static final SecurityManager securityManager;
private static final Permission allPermissions;
private static final boolean DEBUG = false;
+ /**
+ * Deprecated call to {@link System#getSecurityManager()} w/o warnings.
+ */
+ @SuppressWarnings({ "deprecation", "removal" })
+ public static final SecurityManager getSecurityManager() {
+ return System.getSecurityManager();
+ }
+
+ /**
+ * Deprecated call to {@link java.security.AccessController#doPrivileged(PrivilegedAction)} w/o warnings.
+ * @param <T>
+ * @param o
+ * @return
+ */
+ @SuppressWarnings({ "deprecation", "removal" })
+ public static <T> T doPrivileged(final PrivilegedAction<T> o) {
+ return java.security.AccessController.doPrivileged( o );
+ }
+
static {
allPermissions = new AllPermission();
- securityManager = System.getSecurityManager();
+ securityManager = getSecurityManager();
if( DEBUG ) {
final boolean hasAllPermissions;
{
- final ProtectionDomain insecPD = AccessController.doPrivileged(new PrivilegedAction<ProtectionDomain>() {
+ final ProtectionDomain insecPD = doPrivileged(new PrivilegedAction<ProtectionDomain>() {
@Override
public ProtectionDomain run() {
return SecurityUtil.class.getProtectionDomain();
@@ -64,7 +83,7 @@ public class SecurityUtil {
System.err.println("SecurityUtil: Has SecurityManager: "+ ( null != securityManager ) ) ;
System.err.println("SecurityUtil: Has AllPermissions: "+hasAllPermissions);
- final Certificate[] certs = AccessController.doPrivileged(new PrivilegedAction<Certificate[]>() {
+ final Certificate[] certs = doPrivileged(new PrivilegedAction<Certificate[]>() {
@Override
public Certificate[] run() {
return getCerts(SecurityUtil.class);
diff --git a/src/java/com/jogamp/common/util/UnsafeUtil.java b/src/java/com/jogamp/common/util/UnsafeUtil.java
index 6fde3fa..d1b2dd8 100644
--- a/src/java/com/jogamp/common/util/UnsafeUtil.java
+++ b/src/java/com/jogamp/common/util/UnsafeUtil.java
@@ -31,7 +31,6 @@ import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
-import java.security.AccessController;
import java.security.PrivilegedAction;
import com.jogamp.common.ExceptionUtils;
@@ -73,7 +72,7 @@ public class UnsafeUtil {
final Class<?>[] _illegalAccessLoggerClass = { null };
final Long[] _loggerOffset = { null };
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ SecurityUtil.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
Class<?> unsafeClass = null;
@@ -172,7 +171,7 @@ public class UnsafeUtil {
/**
* Issue the given user {@code action} while {@code jdk.internal.module.IllegalAcessLogger}'s {@code logger} has been temporarily disabled.
* <p>
- * The caller shall place this call into their own {@link AccessController#doPrivileged(PrivilegedAction)} block.
+ * The caller shall place this call into their own {@link SecurityUtil#doPrivileged(PrivilegedAction)} block.
* </p>
* <p>
* In case the runtime is not {@link PlatformPropsImpl#JAVA_9} or the logger is not accessible or disabling caused an exception,