summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-01-14 21:31:45 +0100
committerSven Gothel <[email protected]>2023-01-14 21:31:45 +0100
commit72a8be591d5daba1e4e231c386812c543d503fce (patch)
treeb4a08e451741eab5a9cad4617e2151bdfd8f5223 /src/nativewindow/classes
parent4dfe7369d8e58978dc56235344731f927a1c8ae4 (diff)
Replace AccessController.doPrivileged() w/ SecurityUtil.doPrivileged()
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java6
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java4
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/javafx/JFXAccessor.java5
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/BcmVCArtifacts.java5
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/Debug.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java6
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java4
13 files changed, 30 insertions, 28 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java
index bedf15c7b..68ab36ed5 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java
@@ -35,7 +35,6 @@ package com.jogamp.nativewindow;
import java.io.File;
import java.lang.reflect.Method;
-import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
@@ -61,6 +60,7 @@ import com.jogamp.common.os.Platform;
import com.jogamp.common.util.InterruptSource;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.common.util.ReflectionUtil;
+import com.jogamp.common.util.SecurityUtil;
import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos;
import com.jogamp.nativewindow.awt.AWTGraphicsDevice;
import com.jogamp.nativewindow.awt.AWTGraphicsScreen;
@@ -233,7 +233,7 @@ public abstract class NativeWindowFactory {
final String[] _tmp = new String[] { null };
final String[] _nativeWindowingTypeNative = new String[] { null };
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ SecurityUtil.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
Platform.initSingleton(); // last resort ..
@@ -398,7 +398,7 @@ public abstract class NativeWindowFactory {
if( Platform.AWT_AVAILABLE &&
ReflectionUtil.isClassAvailable("com.jogamp.nativewindow.awt.AWTGraphicsDevice", cl) ) {
- final Method[] jawtUtilMethods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
+ final Method[] jawtUtilMethods = SecurityUtil.doPrivileged(new PrivilegedAction<Method[]>() {
@Override
public Method[] run() {
try {
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java
index 8189f6262..4fe2d6cd8 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java
@@ -2,11 +2,11 @@ package com.jogamp.nativewindow.awt;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
-import java.security.AccessController;
import java.security.PrivilegedAction;
import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.RunnableTask;
+import com.jogamp.common.util.SecurityUtil;
import com.jogamp.common.util.UnsafeUtil;
import jogamp.nativewindow.jawt.JAWTUtil;
@@ -28,7 +28,7 @@ public class AppContextInfo {
static {
DEBUG = JAWTUtil.DEBUG;
final Method[] _getAppContextMethod = { null };
- 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/com/jogamp/nativewindow/javafx/JFXAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/javafx/JFXAccessor.java
index 9d38b1f4b..61358c56a 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/javafx/JFXAccessor.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/javafx/JFXAccessor.java
@@ -28,7 +28,6 @@
package com.jogamp.nativewindow.javafx;
import java.lang.reflect.Method;
-import java.security.AccessController;
import java.security.PrivilegedAction;
import com.jogamp.nativewindow.AbstractGraphicsDevice;
@@ -43,6 +42,7 @@ import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.InterruptedRuntimeException;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.common.util.RunnableTask;
+import com.jogamp.common.util.SecurityUtil;
import com.sun.javafx.tk.TKStage;
import javafx.application.Platform;
@@ -69,7 +69,7 @@ public class JFXAccessor {
static {
final boolean[] _DEBUG = new boolean[] { true };
- final Method[] res = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
+ final Method[] res = SecurityUtil.doPrivileged(new PrivilegedAction<Method[]>() {
@Override
public Method[] run() {
NativeWindowFactory.initSingleton(); // last resort ..
@@ -270,6 +270,7 @@ public class JFXAccessor {
public static long getWindowHandle(final Window stageWindow) throws NativeWindowException {
final long h[] = { 0 };
runOnJFXThread(true, new Runnable() {
+ @Override
public void run() {
try {
final TKStage tkStage = (TKStage) tkStageGetter.invoke(stageWindow);
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
index 7f4a94c5b..1ddf14b82 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
@@ -32,7 +32,6 @@ import com.jogamp.common.os.Platform;
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.security.AccessController;
import java.security.PrivilegedAction;
import org.eclipse.swt.SWT;
@@ -50,6 +49,7 @@ import com.jogamp.nativewindow.AbstractGraphicsDevice;
import com.jogamp.nativewindow.NativeWindowFactory;
import com.jogamp.nativewindow.VisualIDHolder;
import com.jogamp.common.util.ReflectionUtil;
+import com.jogamp.common.util.SecurityUtil;
import com.jogamp.common.util.VersionNumber;
import com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice;
import com.jogamp.nativewindow.windows.WindowsGraphicsDevice;
@@ -138,7 +138,7 @@ public class SWTAccessor {
}
static {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ SecurityUtil.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
NativeWindowFactory.initSingleton(); // last resort ..
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);