8038177: Eliminate unnecessary dependency to sun.security.action
Reviewed-by: chegar, alanb
This commit is contained in:
parent
b7a4487e54
commit
ee93384db3
jdk/src
share/classes
com/sun/java/browser/dom
sun
nio/cs/ext
security
solaris/classes
windows/classes/sun/security/mscapi
@ -25,6 +25,9 @@
|
||||
|
||||
package com.sun.java.browser.dom;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
public abstract class DOMService
|
||||
{
|
||||
/**
|
||||
@ -43,8 +46,9 @@ public abstract class DOMService
|
||||
{
|
||||
try
|
||||
{
|
||||
String provider = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("com.sun.java.browser.dom.DOMServiceProvider"));
|
||||
String provider = AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () ->
|
||||
System.getProperty("com.sun.java.browser.dom.DOMServiceProvider"));
|
||||
|
||||
Class clazz = Class.forName("sun.plugin.dom.DOMService");
|
||||
|
||||
|
@ -30,8 +30,7 @@ import java.nio.charset.Charset;
|
||||
import java.nio.charset.spi.CharsetProvider;
|
||||
import sun.nio.cs.AbstractCharsetProvider;
|
||||
import java.security.AccessController;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
/**
|
||||
* Provider for extended charsets.
|
||||
@ -1175,7 +1174,7 @@ public class ExtendedCharsets
|
||||
return;
|
||||
|
||||
String map = AccessController.doPrivileged(
|
||||
new GetPropertyAction("sun.nio.cs.map"));
|
||||
(PrivilegedAction<String>) () -> System.getProperty("sun.nio.cs.map"));
|
||||
boolean sjisIsMS932 = false;
|
||||
boolean iso2022jpIsMS50221 = false;
|
||||
boolean iso2022jpIsMS50220 = false;
|
||||
@ -1296,7 +1295,7 @@ public class ExtendedCharsets
|
||||
}
|
||||
}
|
||||
String osName = AccessController.doPrivileged(
|
||||
new GetPropertyAction("os.name"));
|
||||
(PrivilegedAction<String>) () -> System.getProperty("os.name"));
|
||||
if ("SunOS".equals(osName) || "Linux".equals(osName) || "AIX".equals(osName)
|
||||
|| osName.contains("OS X")) {
|
||||
charset("x-COMPOUND_TEXT", "COMPOUND_TEXT",
|
||||
|
@ -35,7 +35,7 @@ import java.nio.charset.CharacterCodingException;
|
||||
import java.nio.charset.MalformedInputException;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import java.security.AccessController;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import java.security.PrivilegedAction;
|
||||
import static java.lang.Character.UnicodeBlock;
|
||||
|
||||
|
||||
@ -239,12 +239,13 @@ public class JISAutoDetect
|
||||
return ((CharsetDecoder) detectedDecoder).charset();
|
||||
}
|
||||
|
||||
private static final String osName = AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () -> System.getProperty("os.name"));
|
||||
|
||||
/**
|
||||
* Returned Shift_JIS Charset name is OS dependent
|
||||
*/
|
||||
private static String getSJISName() {
|
||||
String osName = AccessController.doPrivileged(
|
||||
new GetPropertyAction("os.name"));
|
||||
if (osName.equals("Solaris") || osName.equals("SunOS"))
|
||||
return("PCK");
|
||||
else if (osName.startsWith("Windows"))
|
||||
@ -258,8 +259,6 @@ public class JISAutoDetect
|
||||
*/
|
||||
|
||||
private static String getEUCJPName() {
|
||||
String osName = AccessController.doPrivileged(
|
||||
new GetPropertyAction("os.name"));
|
||||
if (osName.equals("Solaris") || osName.equals("SunOS"))
|
||||
return("x-eucjp-open");
|
||||
else
|
||||
|
@ -50,8 +50,6 @@ import sun.security.provider.certpath.X509CertificatePair;
|
||||
import sun.security.util.Cache;
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.x509.X500Name;
|
||||
import sun.security.action.GetBooleanAction;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* A <code>CertStore</code> that retrieves <code>Certificates</code> and
|
||||
@ -146,7 +144,7 @@ public final class LDAPCertStore extends CertStoreSpi {
|
||||
|
||||
static {
|
||||
String s = AccessController.doPrivileged(
|
||||
new GetPropertyAction(PROP_LIFETIME));
|
||||
(PrivilegedAction<String>) () -> System.getProperty(PROP_LIFETIME));
|
||||
if (s != null) {
|
||||
LIFETIME = Integer.parseInt(s); // throws NumberFormatException
|
||||
} else {
|
||||
@ -249,7 +247,7 @@ public final class LDAPCertStore extends CertStoreSpi {
|
||||
|
||||
// If property is set to true, disable application resource file lookup.
|
||||
boolean disableAppResourceFiles = AccessController.doPrivileged(
|
||||
new GetBooleanAction(PROP_DISABLE_APP_RESOURCE_FILES));
|
||||
(PrivilegedAction<Boolean>) () -> Boolean.getBoolean(PROP_DISABLE_APP_RESOURCE_FILES));
|
||||
if (disableAppResourceFiles) {
|
||||
if (debug != null) {
|
||||
debug.println("LDAPCertStore disabling app resource files");
|
||||
|
@ -27,13 +27,12 @@ package sun.security.smartcardio;
|
||||
|
||||
import java.nio.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import javax.smartcardio.*;
|
||||
|
||||
import static sun.security.smartcardio.PCSC.*;
|
||||
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* CardChannel implementation.
|
||||
*
|
||||
@ -125,7 +124,8 @@ final class ChannelImpl extends CardChannel {
|
||||
getBooleanProperty("sun.security.smartcardio.t1StripLe", false);
|
||||
|
||||
private static boolean getBooleanProperty(String name, boolean def) {
|
||||
String val = AccessController.doPrivileged(new GetPropertyAction(name));
|
||||
String val = AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () -> System.getProperty(name));
|
||||
if (val == null) {
|
||||
return def;
|
||||
}
|
||||
|
@ -61,10 +61,8 @@ class FileSystemPreferences extends AbstractPreferences {
|
||||
* Sync interval in seconds.
|
||||
*/
|
||||
private static final int SYNC_INTERVAL = Math.max(1,
|
||||
Integer.parseInt(
|
||||
AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction(
|
||||
"java.util.prefs.syncInterval", "30"))));
|
||||
AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
|
||||
Integer.getInteger("java.util.prefs.syncInterval", 30)));
|
||||
|
||||
/**
|
||||
* Returns logger for error messages. Backing store exceptions are logged at
|
||||
|
@ -33,15 +33,15 @@ import java.nio.channels.AlreadyBoundException;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.security.AccessController;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.nio.ch.IOUtil;
|
||||
import sun.nio.ch.Net;
|
||||
import com.sun.nio.sctp.SctpSocketOption;
|
||||
import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
|
||||
|
||||
public class SctpNet {
|
||||
static final String osName = AccessController.doPrivileged(
|
||||
new GetPropertyAction("os.name"));
|
||||
private static final String osName = AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () -> System.getProperty("os.name"));
|
||||
|
||||
/* -- Miscellaneous SCTP utilities -- */
|
||||
|
||||
|
@ -33,6 +33,7 @@ import java.security.AccessController;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.KeyStoreSpi;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecurityPermission;
|
||||
@ -48,8 +49,6 @@ import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* Implementation of key store for Windows using the Microsoft Crypto API.
|
||||
*
|
||||
@ -205,9 +204,8 @@ abstract class KeyStore extends KeyStoreSpi {
|
||||
|
||||
KeyStore(String storeName) {
|
||||
// Get the compatibility mode
|
||||
String prop =
|
||||
AccessController.doPrivileged(
|
||||
new GetPropertyAction(KEYSTORE_COMPATIBILITY_MODE_PROP));
|
||||
String prop = AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () -> System.getProperty(KEYSTORE_COMPATIBILITY_MODE_PROP));
|
||||
|
||||
if ("false".equalsIgnoreCase(prop)) {
|
||||
keyStoreCompatibilityMode = false;
|
||||
|
@ -31,9 +31,6 @@ import java.security.Provider;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import sun.security.action.PutAllAction;
|
||||
|
||||
|
||||
/**
|
||||
* A Cryptographic Service Provider for the Microsoft Crypto API.
|
||||
*
|
||||
@ -140,7 +137,12 @@ public final class SunMSCAPI extends Provider {
|
||||
map.put("Cipher.RSA SupportedKeyClasses", "sun.security.mscapi.Key");
|
||||
|
||||
if (map != this) {
|
||||
AccessController.doPrivileged(new PutAllAction(this, map));
|
||||
final Provider provider = this;
|
||||
PrivilegedAction<Void> putAllAction = () -> {
|
||||
provider.putAll(map);
|
||||
return null;
|
||||
};
|
||||
AccessController.doPrivileged(putAllAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user