diff options
author | Sven Gothel <[email protected]> | 2023-01-14 21:31:45 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-01-14 21:31:45 +0100 |
commit | 72a8be591d5daba1e4e231c386812c543d503fce (patch) | |
tree | b4a08e451741eab5a9cad4617e2151bdfd8f5223 /src/nativewindow/classes/jogamp | |
parent | 4dfe7369d8e58978dc56235344731f927a1c8ae4 (diff) |
Replace AccessController.doPrivileged() w/ SecurityUtil.doPrivileged()
Diffstat (limited to 'src/nativewindow/classes/jogamp')
9 files changed, 20 insertions, 19 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/BcmVCArtifacts.java b/src/nativewindow/classes/jogamp/nativewindow/BcmVCArtifacts.java index 0fc0665bc..a6be62e4e 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/BcmVCArtifacts.java +++ b/src/nativewindow/classes/jogamp/nativewindow/BcmVCArtifacts.java @@ -29,9 +29,10 @@ package jogamp.nativewindow; import java.io.File; -import java.security.AccessController; import java.security.PrivilegedAction; +import com.jogamp.common.util.SecurityUtil; + /** * Heuristics about Broadcom (BCM) VideoCore (VC) existence and usage */ @@ -48,7 +49,7 @@ public class BcmVCArtifacts { final File driCard0Location = new File( "/dev/dri/card0"); final boolean[] res = new boolean [3]; - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { res[0] = vcLibLocation.isFile(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/Debug.java b/src/nativewindow/classes/jogamp/nativewindow/Debug.java index 8d8fd0667..9ccb5b3a5 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/Debug.java +++ b/src/nativewindow/classes/jogamp/nativewindow/Debug.java @@ -28,10 +28,10 @@ package jogamp.nativewindow; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.common.util.PropertyAccess; +import com.jogamp.common.util.SecurityUtil; /** Helper routines for logging and debugging. */ @@ -41,7 +41,7 @@ public class Debug extends PropertyAccess { private static final boolean debugAll; static { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { PropertyAccess.addTrustedPrefix("nativewindow."); diff --git a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java index 1284974bf..7d530dda6 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java @@ -29,16 +29,16 @@ package jogamp.nativewindow; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.common.jvm.JNILibLoaderBase; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.cache.TempJarCache; public class NWJNILibLoader extends JNILibLoaderBase { public static boolean loadNativeWindow(final String ossuffix) { - return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { + return SecurityUtil.doPrivileged(new PrivilegedAction<Boolean>() { @Override public Boolean run() { Platform.initSingleton(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java index fe83ebc76..04585e4ca 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java @@ -39,17 +39,17 @@ package jogamp.nativewindow.jawt; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.nativewindow.NativeWindowFactory; import jogamp.nativewindow.NWJNILibLoader; import java.awt.Toolkit; -import java.security.AccessController; import java.security.PrivilegedAction; public class JAWTJNILibLoader extends NWJNILibLoader { static { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { // Make sure that awt.dll is loaded before loading jawt.dll. Otherwise diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java index f4e55cd47..bb18910fc 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java @@ -45,7 +45,6 @@ import java.awt.Toolkit; import java.awt.geom.AffineTransform; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Map; @@ -67,6 +66,7 @@ import jogamp.nativewindow.x11.X11Lib; import com.jogamp.common.ExceptionUtils; import com.jogamp.common.os.Platform; import com.jogamp.common.util.PropertyAccess; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.UnsafeUtil; import com.jogamp.common.util.VersionNumber; import com.jogamp.common.util.locks.LockFactory; @@ -362,7 +362,7 @@ public class JAWTUtil { // Always enforce using sun.awt.SunToolkit's awtLock even on JVM >= Java_9, // as we have no other official means to synchronize native UI locks especially for X11 { - final SunToolkitData std = AccessController.doPrivileged(new PrivilegedAction<SunToolkitData>() { + final SunToolkitData std = SecurityUtil.doPrivileged(new PrivilegedAction<SunToolkitData>() { @Override public SunToolkitData run() { return UnsafeUtil.doWithoutIllegalAccessLogger(new PrivilegedAction<SunToolkitData>() { @@ -407,7 +407,7 @@ public class JAWTUtil { gdGetScaleFactorMID = null; gdGetCGDisplayIDMIDOnOSX = null; } else { - final GraphicsDeviceData gdd = (GraphicsDeviceData) AccessController.doPrivileged(new PrivilegedAction<Object>() { + final GraphicsDeviceData gdd = (GraphicsDeviceData) SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { final GraphicsDeviceData d = new GraphicsDeviceData(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index f67cc7189..4e89709f2 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -43,7 +43,6 @@ package jogamp.nativewindow.jawt.macosx; import java.awt.Component; import java.awt.GraphicsConfiguration; import java.nio.Buffer; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.nativewindow.AbstractGraphicsConfiguration; @@ -54,6 +53,7 @@ import com.jogamp.nativewindow.MutableSurface; import com.jogamp.nativewindow.util.Point; import com.jogamp.common.util.PropertyAccess; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.nativewindow.awt.JAWTWindow; import jogamp.nativewindow.Debug; @@ -272,7 +272,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { ret = NativeSurface.LOCK_SURFACE_CHANGED; } if (firstLock) { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { dsi = ds.GetDrawingSurfaceInfo(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java index 55aaf90d2..54f34375d 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java @@ -44,10 +44,10 @@ import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.lang.reflect.Method; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.common.ExceptionUtils; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.UnsafeUtil; import com.jogamp.nativewindow.AbstractGraphicsConfiguration; @@ -68,7 +68,7 @@ public class Win32SunJDKReflection { private static boolean initialized; static { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { return UnsafeUtil.doWithoutIllegalAccessLogger(new PrivilegedAction<Object>() { diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java index d86704c07..497d901f5 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java @@ -44,10 +44,10 @@ import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.lang.reflect.Method; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.common.ExceptionUtils; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.UnsafeUtil; import com.jogamp.nativewindow.AbstractGraphicsConfiguration; @@ -67,7 +67,7 @@ public class X11SunJDKReflection { private static boolean initialized; static { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { return UnsafeUtil.doWithoutIllegalAccessLogger(new PrivilegedAction<Object>() { diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java index e06a68953..10a3a602f 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java @@ -32,7 +32,6 @@ import com.jogamp.nativewindow.NativeWindowFactory; import com.jogamp.nativewindow.util.Insets; import com.jogamp.nativewindow.util.Point; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.common.ExceptionUtils; @@ -41,6 +40,7 @@ import com.jogamp.common.util.Function; import com.jogamp.common.util.FunctionTask; import com.jogamp.common.util.InterruptedRuntimeException; import com.jogamp.common.util.RunnableTask; +import com.jogamp.common.util.SecurityUtil; import jogamp.nativewindow.Debug; import jogamp.nativewindow.NWJNILibLoader; @@ -70,7 +70,7 @@ public class OSXUtil implements ToolkitProperties { } if( useMainThreadChecker ) { final String libMainThreadChecker = "/Applications/Xcode.app/Contents/Developer/usr/lib/libMainThreadChecker.dylib"; - final NativeLibrary lib = AccessController.doPrivileged(new PrivilegedAction<NativeLibrary>() { + final NativeLibrary lib = SecurityUtil.doPrivileged(new PrivilegedAction<NativeLibrary>() { @Override public NativeLibrary run() { return NativeLibrary.open(libMainThreadChecker, false, false, OSXUtil.class.getClassLoader(), true); |