No need to explicit use the AccessController when SystemPropertyUtil is used (#9577)
Motivation: SystemPropertyUtil already uses the AccessController internally so not need to wrap its usage with AccessController as well. Modifications: Remove explicit AccessController usage when SystemPropertyUtil is used. Result: Code cleanup
This commit is contained in:
parent
2ba99b4996
commit
fafde4aeec
@ -24,8 +24,6 @@ import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
/**
|
||||
* This static factory should be used to load {@link ResourceLeakDetector}s as needed
|
||||
@ -104,8 +102,7 @@ public abstract class ResourceLeakDetectorFactory {
|
||||
DefaultResourceLeakDetectorFactory() {
|
||||
String customLeakDetector;
|
||||
try {
|
||||
customLeakDetector = AccessController.doPrivileged((PrivilegedAction<String>) () ->
|
||||
SystemPropertyUtil.get("io.netty.customResourceLeakDetector"));
|
||||
customLeakDetector = SystemPropertyUtil.get("io.netty.customResourceLeakDetector");
|
||||
} catch (Throwable cause) {
|
||||
logger.error("Could not access System property: io.netty.customResourceLeakDetector", cause);
|
||||
customLeakDetector = null;
|
||||
|
@ -32,9 +32,7 @@ import io.netty.util.internal.UnstableApi;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.SignatureException;
|
||||
import java.security.cert.CertPathValidatorException;
|
||||
import java.security.cert.Certificate;
|
||||
@ -81,10 +79,9 @@ public abstract class ReferenceCountedOpenSslContext extends SslContext implemen
|
||||
private static final InternalLogger logger =
|
||||
InternalLoggerFactory.getInstance(ReferenceCountedOpenSslContext.class);
|
||||
|
||||
private static final int DEFAULT_BIO_NON_APPLICATION_BUFFER_SIZE =
|
||||
AccessController.doPrivileged((PrivilegedAction<Integer>) () -> Math.max(1,
|
||||
SystemPropertyUtil.getInt("io.netty.handler.ssl.openssl.bioNonApplicationBufferSize",
|
||||
2048)));
|
||||
private static final int DEFAULT_BIO_NON_APPLICATION_BUFFER_SIZE = Math.max(1,
|
||||
SystemPropertyUtil.getInt("io.netty.handler.ssl.openssl.bioNonApplicationBufferSize",
|
||||
2048));
|
||||
static final boolean USE_TASKS =
|
||||
SystemPropertyUtil.getBoolean("io.netty.handler.ssl.openssl.useTasks", false);
|
||||
private static final Integer DH_KEY_LENGTH;
|
||||
@ -165,8 +162,7 @@ public abstract class ReferenceCountedOpenSslContext extends SslContext implemen
|
||||
Integer dhLen = null;
|
||||
|
||||
try {
|
||||
String dhKeySize = AccessController.doPrivileged((PrivilegedAction<String>) () ->
|
||||
SystemPropertyUtil.get("jdk.tls.ephemeralDHKeySize"));
|
||||
String dhKeySize = SystemPropertyUtil.get("jdk.tls.ephemeralDHKeySize");
|
||||
if (dhKeySize != null) {
|
||||
try {
|
||||
dhLen = Integer.valueOf(dhKeySize);
|
||||
|
Loading…
Reference in New Issue
Block a user