From 2534412be45afe939c6dc10693d56fc9a0586956 Mon Sep 17 00:00:00 2001 From: powercas_gamer Date: Wed, 24 Apr 2024 22:13:09 +0200 Subject: [PATCH] remove access controller (#1306) --- .../com/velocitypowered/proxy/VelocityServer.java | 15 +++------------ .../plugin/loader/java/JavaPluginLoader.java | 5 +---- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java index 89f55064e..1a9d71cb4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java @@ -74,9 +74,7 @@ import java.net.InetSocketAddress; import java.net.http.HttpClient; import java.nio.file.Files; import java.nio.file.Path; -import java.security.AccessController; import java.security.KeyPair; -import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collection; import java.util.Locale; @@ -522,8 +520,8 @@ public class VelocityServer implements ProxyServer, ForwardingAudience { // makes sure that all the disconnect events are being fired CompletableFuture playersTeardownFuture = CompletableFuture.allOf(players.stream() - .map(ConnectedPlayer::getTeardownFuture) - .toArray((IntFunction[]>) CompletableFuture[]::new)); + .map(ConnectedPlayer::getTeardownFuture) + .toArray((IntFunction[]>) CompletableFuture[]::new)); playersTeardownFuture.get(10, TimeUnit.SECONDS); } catch (TimeoutException e) { @@ -552,14 +550,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience { shutdown = true; if (explicitExit) { - AccessController.doPrivileged(new PrivilegedAction() { - @Override - @SuppressFBWarnings("DM_EXIT") - public Void run() { - System.exit(0); - return null; - } - }); + System.exit(0); } }; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/plugin/loader/java/JavaPluginLoader.java b/proxy/src/main/java/com/velocitypowered/proxy/plugin/loader/java/JavaPluginLoader.java index 3795efd39..d1df777d3 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/plugin/loader/java/JavaPluginLoader.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/plugin/loader/java/JavaPluginLoader.java @@ -38,8 +38,6 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.HashSet; import java.util.Optional; import java.util.Set; @@ -92,8 +90,7 @@ public class JavaPluginLoader implements PluginLoader { URL pluginJarUrl = candidate.getSource().orElseThrow( () -> new InvalidPluginException("Description provided does not have a source path") ).toUri().toURL(); - PluginClassLoader loader = AccessController.doPrivileged( - (PrivilegedAction) () -> new PluginClassLoader(new URL[]{pluginJarUrl})); + PluginClassLoader loader = new PluginClassLoader(new URL[]{pluginJarUrl}); loader.addToClassloaders(); JavaVelocityPluginDescriptionCandidate candidateInst =