summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util/SecurityUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/common/util/SecurityUtil.java')
-rw-r--r--src/java/com/jogamp/common/util/SecurityUtil.java27
1 files changed, 23 insertions, 4 deletions
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);