From 72a8be591d5daba1e4e231c386812c543d503fce Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 14 Jan 2023 21:31:45 +0100 Subject: Replace AccessController.doPrivileged() w/ SecurityUtil.doPrivileged() --- .../classes/com/jogamp/nativewindow/NativeWindowFactory.java | 6 +++--- .../classes/com/jogamp/nativewindow/awt/AppContextInfo.java | 4 ++-- .../classes/com/jogamp/nativewindow/javafx/JFXAccessor.java | 5 +++-- .../classes/com/jogamp/nativewindow/swt/SWTAccessor.java | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src/nativewindow/classes/com/jogamp') 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() { + SecurityUtil.doPrivileged(new PrivilegedAction() { @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() { + final Method[] jawtUtilMethods = SecurityUtil.doPrivileged(new PrivilegedAction() { @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() { + SecurityUtil.doPrivileged(new PrivilegedAction() { @Override public Object run() { return UnsafeUtil.doWithoutIllegalAccessLogger(new PrivilegedAction() { 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() { + final Method[] res = SecurityUtil.doPrivileged(new PrivilegedAction() { @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() { + SecurityUtil.doPrivileged(new PrivilegedAction() { @Override public Object run() { NativeWindowFactory.initSingleton(); // last resort .. -- cgit v1.2.3