8269409: Post JEP 411 refactoring: core-libs with maximum covering > 10K
Reviewed-by: lancea, naoto
This commit is contained in:
parent
d0d26f5c55
commit
e9b2c058a4
@ -560,7 +560,6 @@ public interface ObjectInputFilter {
|
|||||||
* fully qualified class name of the deserialization filter factory.
|
* fully qualified class name of the deserialization filter factory.
|
||||||
* @since 9
|
* @since 9
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
|
||||||
final class Config {
|
final class Config {
|
||||||
/**
|
/**
|
||||||
* Lock object for filter and filter factory.
|
* Lock object for filter and filter factory.
|
||||||
@ -628,19 +627,17 @@ public interface ObjectInputFilter {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Get the values of the system properties, if they are defined
|
// Get the values of the system properties, if they are defined
|
||||||
String factoryClassName = StaticProperty.jdkSerialFilterFactory();
|
@SuppressWarnings("removal")
|
||||||
if (factoryClassName == null) {
|
String factoryClassName = StaticProperty.jdkSerialFilterFactory() != null
|
||||||
// Fallback to security property
|
? StaticProperty.jdkSerialFilterFactory()
|
||||||
factoryClassName = AccessController.doPrivileged((PrivilegedAction<String>) () ->
|
: AccessController.doPrivileged((PrivilegedAction<String>) () ->
|
||||||
Security.getProperty(SERIAL_FILTER_FACTORY_PROPNAME));
|
Security.getProperty(SERIAL_FILTER_FACTORY_PROPNAME));
|
||||||
}
|
|
||||||
|
|
||||||
String filterString = StaticProperty.jdkSerialFilter();
|
@SuppressWarnings("removal")
|
||||||
if (filterString == null) {
|
String filterString = StaticProperty.jdkSerialFilter() != null
|
||||||
// Fallback to security property
|
? StaticProperty.jdkSerialFilter()
|
||||||
filterString = AccessController.doPrivileged((PrivilegedAction<String>) () ->
|
: AccessController.doPrivileged((PrivilegedAction<String>) () ->
|
||||||
Security.getProperty(SERIAL_FILTER_PROPNAME));
|
Security.getProperty(SERIAL_FILTER_PROPNAME));
|
||||||
}
|
|
||||||
|
|
||||||
traceFilters = GetBooleanAction.privilegedGetProperty(SERIAL_FILTER_TRACE_PROPNAME);
|
traceFilters = GetBooleanAction.privilegedGetProperty(SERIAL_FILTER_TRACE_PROPNAME);
|
||||||
|
|
||||||
@ -743,6 +740,7 @@ public interface ObjectInputFilter {
|
|||||||
*/
|
*/
|
||||||
public static void setSerialFilter(ObjectInputFilter filter) {
|
public static void setSerialFilter(ObjectInputFilter filter) {
|
||||||
Objects.requireNonNull(filter, "filter");
|
Objects.requireNonNull(filter, "filter");
|
||||||
|
@SuppressWarnings("removal")
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
sm.checkPermission(ObjectStreamConstants.SERIAL_FILTER_PERMISSION);
|
sm.checkPermission(ObjectStreamConstants.SERIAL_FILTER_PERMISSION);
|
||||||
@ -836,6 +834,7 @@ public interface ObjectInputFilter {
|
|||||||
*/
|
*/
|
||||||
public static void setSerialFilterFactory(BinaryOperator<ObjectInputFilter> filterFactory) {
|
public static void setSerialFilterFactory(BinaryOperator<ObjectInputFilter> filterFactory) {
|
||||||
Objects.requireNonNull(filterFactory, "filterFactory");
|
Objects.requireNonNull(filterFactory, "filterFactory");
|
||||||
|
@SuppressWarnings("removal")
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
sm.checkPermission(ObjectStreamConstants.SERIAL_FILTER_PERMISSION);
|
sm.checkPermission(ObjectStreamConstants.SERIAL_FILTER_PERMISSION);
|
||||||
|
@ -72,7 +72,6 @@ import jdk.internal.icu.text.UCharacterIterator;
|
|||||||
* @since 1.6
|
* @since 1.6
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public final class IDN {
|
public final class IDN {
|
||||||
/**
|
/**
|
||||||
* Flag to allow processing of unassigned code points
|
* Flag to allow processing of unassigned code points
|
||||||
@ -224,19 +223,15 @@ public final class IDN {
|
|||||||
private static StringPrep namePrep = null;
|
private static StringPrep namePrep = null;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
InputStream stream = null;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final String IDN_PROFILE = "/sun/net/idn/uidna.spp";
|
final String IDN_PROFILE = "/sun/net/idn/uidna.spp";
|
||||||
if (System.getSecurityManager() != null) {
|
@SuppressWarnings("removal")
|
||||||
stream = AccessController.doPrivileged(new PrivilegedAction<>() {
|
InputStream stream = System.getSecurityManager() != null
|
||||||
public InputStream run() {
|
? AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
return StringPrep.class.getResourceAsStream(IDN_PROFILE);
|
public InputStream run() {
|
||||||
}
|
return StringPrep.class.getResourceAsStream(IDN_PROFILE);
|
||||||
});
|
}})
|
||||||
} else {
|
: StringPrep.class.getResourceAsStream(IDN_PROFILE);
|
||||||
stream = StringPrep.class.getResourceAsStream(IDN_PROFILE);
|
|
||||||
}
|
|
||||||
|
|
||||||
namePrep = new StringPrep(stream);
|
namePrep = new StringPrep(stream);
|
||||||
stream.close();
|
stream.close();
|
||||||
|
@ -202,7 +202,6 @@ import sun.util.logging.PlatformLogger;
|
|||||||
*
|
*
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public final class HijrahChronology extends AbstractChronology implements Serializable {
|
public final class HijrahChronology extends AbstractChronology implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -291,8 +290,10 @@ public final class HijrahChronology extends AbstractChronology implements Serial
|
|||||||
AbstractChronology.registerChrono(INSTANCE, "islamic");
|
AbstractChronology.registerChrono(INSTANCE, "islamic");
|
||||||
|
|
||||||
// custom config chronologies
|
// custom config chronologies
|
||||||
CONF_PATH = Path.of(AccessController.doPrivileged((PrivilegedAction<String>)
|
@SuppressWarnings("removal")
|
||||||
() -> System.getProperty("java.home")), "conf", "chronology");
|
String javaHome = AccessController.doPrivileged((PrivilegedAction<String>)
|
||||||
|
() -> System.getProperty("java.home"));
|
||||||
|
CONF_PATH = Path.of(javaHome, "conf", "chronology");
|
||||||
registerCustomChrono();
|
registerCustomChrono();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -840,7 +841,7 @@ public final class HijrahChronology extends AbstractChronology implements Serial
|
|||||||
};
|
};
|
||||||
FilePermission perm1 = new FilePermission("<<ALL FILES>>", "read");
|
FilePermission perm1 = new FilePermission("<<ALL FILES>>", "read");
|
||||||
RuntimePermission perm2 = new RuntimePermission("accessSystemModules");
|
RuntimePermission perm2 = new RuntimePermission("accessSystemModules");
|
||||||
try (InputStream is = AccessController.doPrivileged(getResourceAction, null, perm1, perm2)) {
|
try (@SuppressWarnings("removal") InputStream is = AccessController.doPrivileged(getResourceAction, null, perm1, perm2)) {
|
||||||
if (is == null) {
|
if (is == null) {
|
||||||
throw new RuntimeException("Hijrah calendar resource not found: " + resourceName);
|
throw new RuntimeException("Hijrah calendar resource not found: " + resourceName);
|
||||||
}
|
}
|
||||||
@ -1035,6 +1036,7 @@ public final class HijrahChronology extends AbstractChronology implements Serial
|
|||||||
* Look for Hijrah chronology variant properties files in
|
* Look for Hijrah chronology variant properties files in
|
||||||
* <JAVA_HOME>/conf/chronology directory. Then register its chronology, if any.
|
* <JAVA_HOME>/conf/chronology directory. Then register its chronology, if any.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static void registerCustomChrono() {
|
private static void registerCustomChrono() {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
(PrivilegedAction<Void>)() -> {
|
(PrivilegedAction<Void>)() -> {
|
||||||
|
@ -127,7 +127,6 @@ import java.util.Collections;
|
|||||||
*
|
*
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public abstract class ZoneRulesProvider {
|
public abstract class ZoneRulesProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,26 +146,28 @@ public abstract class ZoneRulesProvider {
|
|||||||
static {
|
static {
|
||||||
// if the property java.time.zone.DefaultZoneRulesProvider is
|
// if the property java.time.zone.DefaultZoneRulesProvider is
|
||||||
// set then its value is the class name of the default provider
|
// set then its value is the class name of the default provider
|
||||||
final List<ZoneRulesProvider> loaded = new ArrayList<>();
|
@SuppressWarnings("removal")
|
||||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
final List<ZoneRulesProvider> loaded =
|
||||||
public Object run() {
|
AccessController.doPrivileged(new PrivilegedAction<List<ZoneRulesProvider>>() {
|
||||||
String prop = System.getProperty("java.time.zone.DefaultZoneRulesProvider");
|
public List<ZoneRulesProvider> run() {
|
||||||
if (prop != null) {
|
List<ZoneRulesProvider> result = new ArrayList<>();
|
||||||
try {
|
String prop = System.getProperty("java.time.zone.DefaultZoneRulesProvider");
|
||||||
Class<?> c = Class.forName(prop, true, ClassLoader.getSystemClassLoader());
|
if (prop != null) {
|
||||||
@SuppressWarnings("deprecation")
|
try {
|
||||||
ZoneRulesProvider provider = ZoneRulesProvider.class.cast(c.newInstance());
|
Class<?> c = Class.forName(prop, true, ClassLoader.getSystemClassLoader());
|
||||||
registerProvider(provider);
|
@SuppressWarnings("deprecation")
|
||||||
loaded.add(provider);
|
ZoneRulesProvider provider = ZoneRulesProvider.class.cast(c.newInstance());
|
||||||
} catch (Exception x) {
|
registerProvider(provider);
|
||||||
throw new Error(x);
|
result.add(provider);
|
||||||
|
} catch (Exception x) {
|
||||||
|
throw new Error(x);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
registerProvider(new TzdbZoneRulesProvider());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
registerProvider(new TzdbZoneRulesProvider());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ServiceLoader<ZoneRulesProvider> sl = ServiceLoader.load(ZoneRulesProvider.class, ClassLoader.getSystemClassLoader());
|
ServiceLoader<ZoneRulesProvider> sl = ServiceLoader.load(ZoneRulesProvider.class, ClassLoader.getSystemClassLoader());
|
||||||
Iterator<ZoneRulesProvider> it = sl.iterator();
|
Iterator<ZoneRulesProvider> it = sl.iterator();
|
||||||
|
@ -111,7 +111,6 @@ import sun.util.logging.PlatformLogger;
|
|||||||
* @see java.math.BigDecimal
|
* @see java.math.BigDecimal
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public final class Currency implements Serializable {
|
public final class Currency implements Serializable {
|
||||||
|
|
||||||
@java.io.Serial
|
@java.io.Serial
|
||||||
@ -210,6 +209,11 @@ public final class Currency implements Serializable {
|
|||||||
private static final int VALID_FORMAT_VERSION = 3;
|
private static final int VALID_FORMAT_VERSION = 3;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
initStatic();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static void initStatic() {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() {
|
public Void run() {
|
||||||
|
@ -47,7 +47,7 @@ import java.util.function.LongBinaryOperator;
|
|||||||
* for classes supporting dynamic striping on 64bit values. The class
|
* for classes supporting dynamic striping on 64bit values. The class
|
||||||
* extends Number so that concrete subclasses must publicly do so.
|
* extends Number so that concrete subclasses must publicly do so.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"removal","serial"})
|
@SuppressWarnings("serial")
|
||||||
abstract class Striped64 extends Number {
|
abstract class Striped64 extends Number {
|
||||||
/*
|
/*
|
||||||
* This class maintains a lazily-initialized table of atomically
|
* This class maintains a lazily-initialized table of atomically
|
||||||
@ -382,12 +382,13 @@ abstract class Striped64 extends Number {
|
|||||||
private static final VarHandle THREAD_PROBE;
|
private static final VarHandle THREAD_PROBE;
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
MethodHandles.Lookup l = MethodHandles.lookup();
|
MethodHandles.Lookup l1 = MethodHandles.lookup();
|
||||||
BASE = l.findVarHandle(Striped64.class,
|
BASE = l1.findVarHandle(Striped64.class,
|
||||||
"base", long.class);
|
"base", long.class);
|
||||||
CELLSBUSY = l.findVarHandle(Striped64.class,
|
CELLSBUSY = l1.findVarHandle(Striped64.class,
|
||||||
"cellsBusy", int.class);
|
"cellsBusy", int.class);
|
||||||
l = java.security.AccessController.doPrivileged(
|
@SuppressWarnings("removal")
|
||||||
|
MethodHandles.Lookup l2 = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public MethodHandles.Lookup run() {
|
public MethodHandles.Lookup run() {
|
||||||
try {
|
try {
|
||||||
@ -396,7 +397,7 @@ abstract class Striped64 extends Number {
|
|||||||
throw new ExceptionInInitializerError(e);
|
throw new ExceptionInInitializerError(e);
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
THREAD_PROBE = l.findVarHandle(Thread.class,
|
THREAD_PROBE = l2.findVarHandle(Thread.class,
|
||||||
"threadLocalRandomProbe", int.class);
|
"threadLocalRandomProbe", int.class);
|
||||||
} catch (ReflectiveOperationException e) {
|
} catch (ReflectiveOperationException e) {
|
||||||
throw new ExceptionInInitializerError(e);
|
throw new ExceptionInInitializerError(e);
|
||||||
|
@ -33,7 +33,6 @@ import java.util.Enumeration;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public class MimeTable implements FileNameMap {
|
public class MimeTable implements FileNameMap {
|
||||||
/** Keyed by content type, returns MimeEntries */
|
/** Keyed by content type, returns MimeEntries */
|
||||||
private Hashtable<String, MimeEntry> entries
|
private Hashtable<String, MimeEntry> entries
|
||||||
@ -44,28 +43,15 @@ public class MimeTable implements FileNameMap {
|
|||||||
= new Hashtable<String, MimeEntry>();
|
= new Hashtable<String, MimeEntry>();
|
||||||
|
|
||||||
// Will be reset if in the platform-specific data file
|
// Will be reset if in the platform-specific data file
|
||||||
private static String tempFileTemplate;
|
@SuppressWarnings("removal")
|
||||||
|
private static String tempFileTemplate =
|
||||||
static {
|
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<String>() {
|
||||||
public Void run() {
|
public String run() {
|
||||||
tempFileTemplate =
|
return System.getProperty("content.types.temp.file.template",
|
||||||
System.getProperty("content.types.temp.file.template",
|
"/tmp/%s");
|
||||||
"/tmp/%s");
|
}
|
||||||
|
});
|
||||||
mailcapLocations = new String[] {
|
|
||||||
System.getProperty("user.mailcap"),
|
|
||||||
StaticProperty.userHome() + "/.mailcap",
|
|
||||||
"/etc/mailcap",
|
|
||||||
"/usr/etc/mailcap",
|
|
||||||
"/usr/local/etc/mailcap",
|
|
||||||
};
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static final String filePreamble = "sun.net.www MIME content-types table";
|
private static final String filePreamble = "sun.net.www MIME content-types table";
|
||||||
private static final String fileMagic = "#" + filePreamble;
|
private static final String fileMagic = "#" + filePreamble;
|
||||||
@ -77,6 +63,7 @@ public class MimeTable implements FileNameMap {
|
|||||||
private static class DefaultInstanceHolder {
|
private static class DefaultInstanceHolder {
|
||||||
static final MimeTable defaultInstance = getDefaultInstance();
|
static final MimeTable defaultInstance = getDefaultInstance();
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
static MimeTable getDefaultInstance() {
|
static MimeTable getDefaultInstance() {
|
||||||
return java.security.AccessController.doPrivileged(
|
return java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<MimeTable>() {
|
new java.security.PrivilegedAction<MimeTable>() {
|
||||||
@ -220,7 +207,20 @@ public class MimeTable implements FileNameMap {
|
|||||||
// For backward compatibility -- mailcap format files
|
// For backward compatibility -- mailcap format files
|
||||||
// This is not currently used, but may in the future when we add ability
|
// This is not currently used, but may in the future when we add ability
|
||||||
// to read BOTH the properties format and the mailcap format.
|
// to read BOTH the properties format and the mailcap format.
|
||||||
protected static String[] mailcapLocations;
|
@SuppressWarnings("removal")
|
||||||
|
protected static String[] mailcapLocations =
|
||||||
|
java.security.AccessController.doPrivileged(
|
||||||
|
new java.security.PrivilegedAction<String[]>() {
|
||||||
|
public String[] run() {
|
||||||
|
return new String[]{
|
||||||
|
System.getProperty("user.mailcap"),
|
||||||
|
StaticProperty.userHome() + "/.mailcap",
|
||||||
|
"/etc/mailcap",
|
||||||
|
"/usr/etc/mailcap",
|
||||||
|
"/usr/local/etc/mailcap",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
public synchronized void load() {
|
public synchronized void load() {
|
||||||
Properties entries = new Properties();
|
Properties entries = new Properties();
|
||||||
@ -388,6 +388,7 @@ public class MimeTable implements FileNameMap {
|
|||||||
properties.put("temp.file.template", tempFileTemplate);
|
properties.put("temp.file.template", tempFileTemplate);
|
||||||
String tag;
|
String tag;
|
||||||
// Perform the property security check for user.name
|
// Perform the property security check for user.name
|
||||||
|
@SuppressWarnings("removal")
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
sm.checkPropertyAccess("user.name");
|
sm.checkPropertyAccess("user.name");
|
||||||
|
@ -53,7 +53,6 @@ import sun.net.www.HeaderParser;
|
|||||||
// policy in HttpURLConnection. A failure on baz.foo.com shouldn't
|
// policy in HttpURLConnection. A failure on baz.foo.com shouldn't
|
||||||
// uncache foo.com!
|
// uncache foo.com!
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public abstract class AuthenticationInfo extends AuthCacheValue implements Cloneable {
|
public abstract class AuthenticationInfo extends AuthCacheValue implements Cloneable {
|
||||||
|
|
||||||
@java.io.Serial
|
@java.io.Serial
|
||||||
@ -70,12 +69,10 @@ public abstract class AuthenticationInfo extends AuthCacheValue implements Clone
|
|||||||
* repeatedly, via the Authenticator. Default is false, which means that this
|
* repeatedly, via the Authenticator. Default is false, which means that this
|
||||||
* behavior is switched off.
|
* behavior is switched off.
|
||||||
*/
|
*/
|
||||||
static final boolean serializeAuth;
|
@SuppressWarnings("removal")
|
||||||
static {
|
static final boolean serializeAuth = java.security.AccessController.doPrivileged(
|
||||||
serializeAuth = java.security.AccessController.doPrivileged(
|
|
||||||
new sun.security.action.GetBooleanAction(
|
new sun.security.action.GetBooleanAction(
|
||||||
"http.auth.serializeRequests")).booleanValue();
|
"http.auth.serializeRequests")).booleanValue();
|
||||||
}
|
|
||||||
|
|
||||||
/* AuthCacheValue: */
|
/* AuthCacheValue: */
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ import sun.security.action.GetPropertyAction;
|
|||||||
* <p>
|
* <p>
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public final class ZoneInfoFile {
|
public final class ZoneInfoFile {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -249,6 +248,11 @@ public final class ZoneInfoFile {
|
|||||||
.privilegedGetProperty("sun.timezone.ids.oldmapping", "false")
|
.privilegedGetProperty("sun.timezone.ids.oldmapping", "false")
|
||||||
.toLowerCase(Locale.ROOT);
|
.toLowerCase(Locale.ROOT);
|
||||||
USE_OLDMAPPING = (oldmapping.equals("yes") || oldmapping.equals("true"));
|
USE_OLDMAPPING = (oldmapping.equals("yes") || oldmapping.equals("true"));
|
||||||
|
loadTZDB();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static void loadTZDB() {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
try {
|
try {
|
||||||
|
@ -474,6 +474,7 @@ public class ManagementFactory {
|
|||||||
* @see javax.management.MBeanServerFactory#createMBeanServer
|
* @see javax.management.MBeanServerFactory#createMBeanServer
|
||||||
*/
|
*/
|
||||||
public static synchronized MBeanServer getPlatformMBeanServer() {
|
public static synchronized MBeanServer getPlatformMBeanServer() {
|
||||||
|
@SuppressWarnings("removal")
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
Permission perm = new MBeanServerPermission("createMBeanServer");
|
Permission perm = new MBeanServerPermission("createMBeanServer");
|
||||||
@ -598,6 +599,7 @@ public class ManagementFactory {
|
|||||||
// Only allow MXBean interfaces from the platform modules loaded by the
|
// Only allow MXBean interfaces from the platform modules loaded by the
|
||||||
// bootstrap or platform class loader
|
// bootstrap or platform class loader
|
||||||
final Class<?> cls = mxbeanInterface;
|
final Class<?> cls = mxbeanInterface;
|
||||||
|
@SuppressWarnings("removal")
|
||||||
ClassLoader loader =
|
ClassLoader loader =
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
(PrivilegedAction<ClassLoader>) () -> cls.getClassLoader());
|
(PrivilegedAction<ClassLoader>) () -> cls.getClassLoader());
|
||||||
@ -885,6 +887,7 @@ public class ManagementFactory {
|
|||||||
private static final String NOTIF_EMITTER =
|
private static final String NOTIF_EMITTER =
|
||||||
"javax.management.NotificationEmitter";
|
"javax.management.NotificationEmitter";
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static void addMXBean(final MBeanServer mbs, String name, final Object pmo)
|
private static void addMXBean(final MBeanServer mbs, String name, final Object pmo)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -920,6 +923,7 @@ public class ManagementFactory {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
// get all providers
|
// get all providers
|
||||||
|
@SuppressWarnings("removal")
|
||||||
List<PlatformMBeanProvider> providers = AccessController.doPrivileged(
|
List<PlatformMBeanProvider> providers = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<List<PlatformMBeanProvider>>() {
|
new PrivilegedAction<List<PlatformMBeanProvider>>() {
|
||||||
@Override
|
@Override
|
||||||
@ -1012,6 +1016,11 @@ public class ManagementFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
loadNativeLib();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static void loadNativeLib() {
|
||||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||||
System.loadLibrary("management");
|
System.loadLibrary("management");
|
||||||
return null;
|
return null;
|
||||||
|
@ -81,7 +81,7 @@ import sun.reflect.misc.ReflectUtil;
|
|||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"removal","serial"}) // serialVersionUID not constant
|
@SuppressWarnings("serial") // serialVersionUID not constant
|
||||||
public class DescriptorSupport
|
public class DescriptorSupport
|
||||||
implements javax.management.Descriptor
|
implements javax.management.Descriptor
|
||||||
{
|
{
|
||||||
@ -119,16 +119,8 @@ public class DescriptorSupport
|
|||||||
private static final ObjectStreamField[] serialPersistentFields;
|
private static final ObjectStreamField[] serialPersistentFields;
|
||||||
private static final String serialForm;
|
private static final String serialForm;
|
||||||
static {
|
static {
|
||||||
String form = null;
|
serialForm = getForm();
|
||||||
boolean compat = false;
|
boolean compat = "1.0".equals(serialForm); // serialForm may be null
|
||||||
try {
|
|
||||||
GetPropertyAction act = new GetPropertyAction("jmx.serial.form");
|
|
||||||
form = AccessController.doPrivileged(act);
|
|
||||||
compat = "1.0".equals(form); // form may be null
|
|
||||||
} catch (Exception e) {
|
|
||||||
// OK: No compat with 1.0
|
|
||||||
}
|
|
||||||
serialForm = form;
|
|
||||||
if (compat) {
|
if (compat) {
|
||||||
serialPersistentFields = oldSerialPersistentFields;
|
serialPersistentFields = oldSerialPersistentFields;
|
||||||
serialVersionUID = oldSerialVersionUID;
|
serialVersionUID = oldSerialVersionUID;
|
||||||
@ -137,6 +129,19 @@ public class DescriptorSupport
|
|||||||
serialVersionUID = newSerialVersionUID;
|
serialVersionUID = newSerialVersionUID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static String getForm() {
|
||||||
|
String form = null;
|
||||||
|
try {
|
||||||
|
GetPropertyAction act = new GetPropertyAction("jmx.serial.form");
|
||||||
|
return AccessController.doPrivileged(act);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// OK: No compat with 1.0
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// END Serialization compatibility stuff
|
// END Serialization compatibility stuff
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@ import jdk.internal.misc.InnocuousThread;
|
|||||||
* @author Rosanna Lee
|
* @author Rosanna Lee
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public final class LdapPoolManager {
|
public final class LdapPoolManager {
|
||||||
private static final String DEBUG =
|
private static final String DEBUG =
|
||||||
"com.sun.jndi.ldap.connect.pool.debug";
|
"com.sun.jndi.ldap.connect.pool.debug";
|
||||||
@ -164,18 +163,7 @@ public final class LdapPoolManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (idleTimeout > 0) {
|
if (idleTimeout > 0) {
|
||||||
// Create cleaner to expire idle connections
|
startCleanerThread();
|
||||||
PrivilegedAction<Void> pa = new PrivilegedAction<Void>() {
|
|
||||||
public Void run() {
|
|
||||||
Thread t = InnocuousThread.newSystemThread(
|
|
||||||
"LDAP PoolCleaner",
|
|
||||||
new PoolCleaner(idleTimeout, pools));
|
|
||||||
assert t.getContextClassLoader() == null;
|
|
||||||
t.setDaemon(true);
|
|
||||||
t.start();
|
|
||||||
return null;
|
|
||||||
}};
|
|
||||||
AccessController.doPrivileged(pa);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
@ -183,6 +171,22 @@ public final class LdapPoolManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static void startCleanerThread() {
|
||||||
|
// Create cleaner to expire idle connections
|
||||||
|
PrivilegedAction<Void> pa = new PrivilegedAction<Void>() {
|
||||||
|
public Void run() {
|
||||||
|
Thread t = InnocuousThread.newSystemThread(
|
||||||
|
"LDAP PoolCleaner",
|
||||||
|
new PoolCleaner(idleTimeout, pools));
|
||||||
|
assert t.getContextClassLoader() == null;
|
||||||
|
t.setDaemon(true);
|
||||||
|
t.start();
|
||||||
|
return null;
|
||||||
|
}};
|
||||||
|
AccessController.doPrivileged(pa);
|
||||||
|
}
|
||||||
|
|
||||||
// Cannot instantiate one of these
|
// Cannot instantiate one of these
|
||||||
private LdapPoolManager() {
|
private LdapPoolManager() {
|
||||||
}
|
}
|
||||||
@ -396,16 +400,19 @@ public final class LdapPoolManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final String getProperty(final String propName, final String defVal) {
|
private static final String getProperty(final String propName, final String defVal) {
|
||||||
PrivilegedAction<String> pa = () -> System.getProperty(propName, defVal);
|
PrivilegedAction<String> pa = () -> System.getProperty(propName, defVal);
|
||||||
return AccessController.doPrivileged(pa);
|
return AccessController.doPrivileged(pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final int getInteger(final String propName, final int defVal) {
|
private static final int getInteger(final String propName, final int defVal) {
|
||||||
PrivilegedAction<Integer> pa = () -> Integer.getInteger(propName, defVal);
|
PrivilegedAction<Integer> pa = () -> Integer.getInteger(propName, defVal);
|
||||||
return AccessController.doPrivileged(pa);
|
return AccessController.doPrivileged(pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final long getLong(final String propName, final long defVal) {
|
private static final long getLong(final String propName, final long defVal) {
|
||||||
PrivilegedAction<Long> pa = () -> Long.getLong(propName, defVal);
|
PrivilegedAction<Long> pa = () -> Long.getLong(propName, defVal);
|
||||||
return AccessController.doPrivileged(pa);
|
return AccessController.doPrivileged(pa);
|
||||||
|
@ -76,10 +76,14 @@ import java.lang.ref.WeakReference;
|
|||||||
it's expensive and is usually not necessary.
|
it's expensive and is usually not necessary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
|
||||||
class MacOSXPreferencesFile {
|
class MacOSXPreferencesFile {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
loadPrefsLib();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static void loadPrefsLib() {
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<Void>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
|
@ -46,10 +46,14 @@ import sun.util.logging.PlatformLogger;
|
|||||||
* @see Preferences
|
* @see Preferences
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
|
||||||
class FileSystemPreferences extends AbstractPreferences {
|
class FileSystemPreferences extends AbstractPreferences {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
loadPrefsLib();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static void loadPrefsLib() {
|
||||||
PrivilegedAction<Void> load = () -> {
|
PrivilegedAction<Void> load = () -> {
|
||||||
System.loadLibrary("prefs");
|
System.loadLibrary("prefs");
|
||||||
return null;
|
return null;
|
||||||
@ -60,6 +64,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
/**
|
/**
|
||||||
* Sync interval in seconds.
|
* Sync interval in seconds.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final int SYNC_INTERVAL = Math.max(1,
|
private static final int SYNC_INTERVAL = Math.max(1,
|
||||||
AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
|
AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
|
||||||
Integer.getInteger("java.util.prefs.syncInterval", 30)));
|
Integer.getInteger("java.util.prefs.syncInterval", 30)));
|
||||||
@ -111,6 +116,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static void setupUserRoot() {
|
private static void setupUserRoot() {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
@ -178,6 +184,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static void setupSystemRoot() {
|
private static void setupSystemRoot() {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
@ -445,6 +452,11 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
private static Timer syncTimer = new Timer(true); // Daemon Thread
|
private static Timer syncTimer = new Timer(true); // Daemon Thread
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
addShutdownHook();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static void addShutdownHook() {
|
||||||
// Add periodic timer task to periodically sync cached prefs
|
// Add periodic timer task to periodically sync cached prefs
|
||||||
syncTimer.schedule(new TimerTask() {
|
syncTimer.schedule(new TimerTask() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -513,6 +525,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
* parent node and name. This constructor, called from childSpi,
|
* parent node and name. This constructor, called from childSpi,
|
||||||
* is used to make every node except for the two //roots.
|
* is used to make every node except for the two //roots.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private FileSystemPreferences(FileSystemPreferences parent, String name) {
|
private FileSystemPreferences(FileSystemPreferences parent, String name) {
|
||||||
super(parent, name);
|
super(parent, name);
|
||||||
isUserNode = parent.isUserNode;
|
isUserNode = parent.isUserNode;
|
||||||
@ -582,6 +595,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
* fails, a BackingStoreException is thrown and both prefsCache and
|
* fails, a BackingStoreException is thrown and both prefsCache and
|
||||||
* lastSyncTime are unaffected by the call.
|
* lastSyncTime are unaffected by the call.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private void loadCache() throws BackingStoreException {
|
private void loadCache() throws BackingStoreException {
|
||||||
try {
|
try {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
@ -629,6 +643,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
* and lastSyncTime will be unaffected by this call. This call will
|
* and lastSyncTime will be unaffected by this call. This call will
|
||||||
* NEVER leave prefsFile in a corrupt state.
|
* NEVER leave prefsFile in a corrupt state.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private void writeBackCache() throws BackingStoreException {
|
private void writeBackCache() throws BackingStoreException {
|
||||||
try {
|
try {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
@ -662,6 +677,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
return prefsCache.keySet().toArray(new String[prefsCache.size()]);
|
return prefsCache.keySet().toArray(new String[prefsCache.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
protected String[] childrenNamesSpi() {
|
protected String[] childrenNamesSpi() {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedAction<String[]>() {
|
new PrivilegedAction<String[]>() {
|
||||||
@ -700,6 +716,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
/**
|
/**
|
||||||
* Called with file lock held (in addition to node locks).
|
* Called with file lock held (in addition to node locks).
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
protected void removeNodeSpi() throws BackingStoreException {
|
protected void removeNodeSpi() throws BackingStoreException {
|
||||||
try {
|
try {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
@ -734,6 +751,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
public synchronized void sync() throws BackingStoreException {
|
public synchronized void sync() throws BackingStoreException {
|
||||||
boolean userNode = isUserNode();
|
boolean userNode = isUserNode();
|
||||||
boolean shared;
|
boolean shared;
|
||||||
@ -783,6 +801,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
protected void syncSpi() throws BackingStoreException {
|
protected void syncSpi() throws BackingStoreException {
|
||||||
try {
|
try {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
|
@ -44,10 +44,14 @@ import sun.util.logging.PlatformLogger;
|
|||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
|
||||||
class WindowsPreferences extends AbstractPreferences {
|
class WindowsPreferences extends AbstractPreferences {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
loadPrefsLib();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static void loadPrefsLib() {
|
||||||
PrivilegedAction<Void> load = () -> {
|
PrivilegedAction<Void> load = () -> {
|
||||||
System.loadLibrary("prefs");
|
System.loadLibrary("prefs");
|
||||||
return null;
|
return null;
|
||||||
|
@ -82,7 +82,6 @@ import java.security.ProtectionDomain;
|
|||||||
* @author Ann Wollrath
|
* @author Ann Wollrath
|
||||||
* @author Peter Jones
|
* @author Peter Jones
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
|
||||||
final class DGCClient {
|
final class DGCClient {
|
||||||
|
|
||||||
/** next sequence number for DGC calls (access synchronized on class) */
|
/** next sequence number for DGC calls (access synchronized on class) */
|
||||||
@ -92,16 +91,19 @@ final class DGCClient {
|
|||||||
private static VMID vmid = new VMID();
|
private static VMID vmid = new VMID();
|
||||||
|
|
||||||
/** lease duration to request (usually ignored by server) */
|
/** lease duration to request (usually ignored by server) */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final long leaseValue = // default 10 minutes
|
private static final long leaseValue = // default 10 minutes
|
||||||
AccessController.doPrivileged((PrivilegedAction<Long>) () ->
|
AccessController.doPrivileged((PrivilegedAction<Long>) () ->
|
||||||
Long.getLong("java.rmi.dgc.leaseValue", 600000));
|
Long.getLong("java.rmi.dgc.leaseValue", 600000));
|
||||||
|
|
||||||
/** maximum interval between retries of failed clean calls */
|
/** maximum interval between retries of failed clean calls */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final long cleanInterval = // default 3 minutes
|
private static final long cleanInterval = // default 3 minutes
|
||||||
AccessController.doPrivileged((PrivilegedAction<Long>) () ->
|
AccessController.doPrivileged((PrivilegedAction<Long>) () ->
|
||||||
Long.getLong("sun.rmi.dgc.cleanInterval", 180000));
|
Long.getLong("sun.rmi.dgc.cleanInterval", 180000));
|
||||||
|
|
||||||
/** maximum interval between complete garbage collections of local heap */
|
/** maximum interval between complete garbage collections of local heap */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final long gcInterval = // default 1 hour
|
private static final long gcInterval = // default 1 hour
|
||||||
AccessController.doPrivileged((PrivilegedAction<Long>) () ->
|
AccessController.doPrivileged((PrivilegedAction<Long>) () ->
|
||||||
Long.getLong("sun.rmi.dgc.client.gcInterval", 3600000));
|
Long.getLong("sun.rmi.dgc.client.gcInterval", 3600000));
|
||||||
@ -122,12 +124,15 @@ final class DGCClient {
|
|||||||
* An AccessControlContext with only socket permissions,
|
* An AccessControlContext with only socket permissions,
|
||||||
* suitable for an RMIClientSocketFactory.
|
* suitable for an RMIClientSocketFactory.
|
||||||
*/
|
*/
|
||||||
private static final AccessControlContext SOCKET_ACC;
|
@SuppressWarnings("removal")
|
||||||
static {
|
private static final AccessControlContext SOCKET_ACC = createSocketAcc();
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static AccessControlContext createSocketAcc() {
|
||||||
Permissions perms = new Permissions();
|
Permissions perms = new Permissions();
|
||||||
perms.add(new SocketPermission("*", "connect,resolve"));
|
perms.add(new SocketPermission("*", "connect,resolve"));
|
||||||
ProtectionDomain[] pd = { new ProtectionDomain(null, perms) };
|
ProtectionDomain[] pd = { new ProtectionDomain(null, perms) };
|
||||||
SOCKET_ACC = new AccessControlContext(pd);
|
return new AccessControlContext(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -251,6 +256,7 @@ final class DGCClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private EndpointEntry(final Endpoint endpoint) {
|
private EndpointEntry(final Endpoint endpoint) {
|
||||||
this.endpoint = endpoint;
|
this.endpoint = endpoint;
|
||||||
try {
|
try {
|
||||||
@ -490,6 +496,7 @@ final class DGCClient {
|
|||||||
*
|
*
|
||||||
* This method must ONLY be called while synchronized on this entry.
|
* This method must ONLY be called while synchronized on this entry.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private void setRenewTime(long newRenewTime) {
|
private void setRenewTime(long newRenewTime) {
|
||||||
assert Thread.holdsLock(this);
|
assert Thread.holdsLock(this);
|
||||||
|
|
||||||
@ -515,6 +522,7 @@ final class DGCClient {
|
|||||||
*/
|
*/
|
||||||
private class RenewCleanThread implements Runnable {
|
private class RenewCleanThread implements Runnable {
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
public void run() {
|
public void run() {
|
||||||
do {
|
do {
|
||||||
long timeToWait;
|
long timeToWait;
|
||||||
|
@ -64,25 +64,29 @@ import sun.rmi.server.Util;
|
|||||||
*
|
*
|
||||||
* @author Ann Wollrath
|
* @author Ann Wollrath
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"removal","deprecation"})
|
@SuppressWarnings("deprecation")
|
||||||
final class DGCImpl implements DGC {
|
final class DGCImpl implements DGC {
|
||||||
|
|
||||||
/* dgc system log */
|
/* dgc system log */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
static final Log dgcLog = Log.getLog("sun.rmi.dgc", "dgc",
|
static final Log dgcLog = Log.getLog("sun.rmi.dgc", "dgc",
|
||||||
LogStream.parseLevel(AccessController.doPrivileged(
|
LogStream.parseLevel(AccessController.doPrivileged(
|
||||||
(PrivilegedAction<String>) () -> System.getProperty("sun.rmi.dgc.logLevel"))));
|
(PrivilegedAction<String>) () -> System.getProperty("sun.rmi.dgc.logLevel"))));
|
||||||
|
|
||||||
/** lease duration to grant to clients */
|
/** lease duration to grant to clients */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final long leaseValue = // default 10 minutes
|
private static final long leaseValue = // default 10 minutes
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
(PrivilegedAction<Long>) () -> Long.getLong("java.rmi.dgc.leaseValue", 600000));
|
(PrivilegedAction<Long>) () -> Long.getLong("java.rmi.dgc.leaseValue", 600000));
|
||||||
|
|
||||||
/** lease check interval; default is half of lease grant duration */
|
/** lease check interval; default is half of lease grant duration */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final long leaseCheckInterval =
|
private static final long leaseCheckInterval =
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
(PrivilegedAction<Long>) () -> Long.getLong("sun.rmi.dgc.checkInterval", leaseValue / 2));
|
(PrivilegedAction<Long>) () -> Long.getLong("sun.rmi.dgc.checkInterval", leaseValue / 2));
|
||||||
|
|
||||||
/** thread pool for scheduling delayed tasks */
|
/** thread pool for scheduling delayed tasks */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final ScheduledExecutorService scheduler =
|
private static final ScheduledExecutorService scheduler =
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new RuntimeUtil.GetInstanceAction()).getScheduler();
|
new RuntimeUtil.GetInstanceAction()).getScheduler();
|
||||||
@ -120,6 +124,7 @@ final class DGCImpl implements DGC {
|
|||||||
* The dgcFilter created from the value of the {@code "sun.rmi.transport.dgcFilter"}
|
* The dgcFilter created from the value of the {@code "sun.rmi.transport.dgcFilter"}
|
||||||
* property.
|
* property.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final ObjectInputFilter dgcFilter =
|
private static final ObjectInputFilter dgcFilter =
|
||||||
AccessController.doPrivileged((PrivilegedAction<ObjectInputFilter>)DGCImpl::initDgcFilter);
|
AccessController.doPrivileged((PrivilegedAction<ObjectInputFilter>)DGCImpl::initDgcFilter);
|
||||||
|
|
||||||
@ -315,6 +320,11 @@ final class DGCImpl implements DGC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
exportSingleton();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static void exportSingleton() {
|
||||||
/*
|
/*
|
||||||
* "Export" the singleton DGCImpl in a context isolated from
|
* "Export" the singleton DGCImpl in a context isolated from
|
||||||
* the arbitrary current thread context.
|
* the arbitrary current thread context.
|
||||||
|
@ -83,21 +83,24 @@ import sun.rmi.transport.TransportConstants;
|
|||||||
* @author Ann Wollrath
|
* @author Ann Wollrath
|
||||||
* @author Peter Jones
|
* @author Peter Jones
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"removal","deprecation"})
|
@SuppressWarnings("deprecation")
|
||||||
public class TCPTransport extends Transport {
|
public class TCPTransport extends Transport {
|
||||||
|
|
||||||
/* tcp package log */
|
/* tcp package log */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
static final Log tcpLog = Log.getLog("sun.rmi.transport.tcp", "tcp",
|
static final Log tcpLog = Log.getLog("sun.rmi.transport.tcp", "tcp",
|
||||||
LogStream.parseLevel(AccessController.doPrivileged(
|
LogStream.parseLevel(AccessController.doPrivileged(
|
||||||
(PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.tcp.logLevel"))));
|
(PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.tcp.logLevel"))));
|
||||||
|
|
||||||
/** maximum number of connection handler threads */
|
/** maximum number of connection handler threads */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final int maxConnectionThreads = // default no limit
|
private static final int maxConnectionThreads = // default no limit
|
||||||
AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
|
AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
|
||||||
Integer.getInteger("sun.rmi.transport.tcp.maxConnectionThreads",
|
Integer.getInteger("sun.rmi.transport.tcp.maxConnectionThreads",
|
||||||
Integer.MAX_VALUE));
|
Integer.MAX_VALUE));
|
||||||
|
|
||||||
/** keep alive time for idle connection handler threads */
|
/** keep alive time for idle connection handler threads */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final long threadKeepAliveTime = // default 1 minute
|
private static final long threadKeepAliveTime = // default 1 minute
|
||||||
AccessController.doPrivileged((PrivilegedAction<Long>) () ->
|
AccessController.doPrivileged((PrivilegedAction<Long>) () ->
|
||||||
Long.getLong("sun.rmi.transport.tcp.threadKeepAliveTime", 60000));
|
Long.getLong("sun.rmi.transport.tcp.threadKeepAliveTime", 60000));
|
||||||
@ -108,6 +111,7 @@ public class TCPTransport extends Transport {
|
|||||||
threadKeepAliveTime, TimeUnit.MILLISECONDS,
|
threadKeepAliveTime, TimeUnit.MILLISECONDS,
|
||||||
new SynchronousQueue<Runnable>(),
|
new SynchronousQueue<Runnable>(),
|
||||||
new ThreadFactory() {
|
new ThreadFactory() {
|
||||||
|
@SuppressWarnings("removal")
|
||||||
public Thread newThread(Runnable runnable) {
|
public Thread newThread(Runnable runnable) {
|
||||||
return AccessController.doPrivileged(new NewThreadAction(
|
return AccessController.doPrivileged(new NewThreadAction(
|
||||||
runnable, "TCP Connection(idle)", true, true));
|
runnable, "TCP Connection(idle)", true, true));
|
||||||
@ -122,11 +126,14 @@ public class TCPTransport extends Transport {
|
|||||||
threadConnectionHandler = new ThreadLocal<>();
|
threadConnectionHandler = new ThreadLocal<>();
|
||||||
|
|
||||||
/** an AccessControlContext with no permissions */
|
/** an AccessControlContext with no permissions */
|
||||||
private static final AccessControlContext NOPERMS_ACC;
|
@SuppressWarnings("removal")
|
||||||
static {
|
private static final AccessControlContext NOPERMS_ACC = createNopermsAcc();
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static AccessControlContext createNopermsAcc() {
|
||||||
Permissions perms = new Permissions();
|
Permissions perms = new Permissions();
|
||||||
ProtectionDomain[] pd = { new ProtectionDomain(null, perms) };
|
ProtectionDomain[] pd = { new ProtectionDomain(null, perms) };
|
||||||
NOPERMS_ACC = new AccessControlContext(pd);
|
return new AccessControlContext(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** endpoints for this transport */
|
/** endpoints for this transport */
|
||||||
@ -148,6 +155,7 @@ public class TCPTransport extends Transport {
|
|||||||
* The maximum representable value is slightly more than 24 days
|
* The maximum representable value is slightly more than 24 days
|
||||||
* and 20 hours.
|
* and 20 hours.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final int connectionReadTimeout = // default 2 hours
|
private static final int connectionReadTimeout = // default 2 hours
|
||||||
AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
|
AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
|
||||||
Integer.getInteger("sun.rmi.transport.tcp.readTimeout", 2 * 3600 * 1000));
|
Integer.getInteger("sun.rmi.transport.tcp.readTimeout", 2 * 3600 * 1000));
|
||||||
@ -298,7 +306,8 @@ public class TCPTransport extends Transport {
|
|||||||
* Verify that the current access control context has permission to
|
* Verify that the current access control context has permission to
|
||||||
* accept the connection being dispatched by the current thread.
|
* accept the connection being dispatched by the current thread.
|
||||||
*/
|
*/
|
||||||
protected void checkAcceptPermission(AccessControlContext acc) {
|
protected void checkAcceptPermission(@SuppressWarnings("removal") AccessControlContext acc) {
|
||||||
|
@SuppressWarnings("removal")
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm == null) {
|
if (sm == null) {
|
||||||
return;
|
return;
|
||||||
@ -338,6 +347,7 @@ public class TCPTransport extends Transport {
|
|||||||
* "port in use" will cause export to hang if an
|
* "port in use" will cause export to hang if an
|
||||||
* RMIFailureHandler is not installed.
|
* RMIFailureHandler is not installed.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
Thread t = AccessController.doPrivileged(
|
Thread t = AccessController.doPrivileged(
|
||||||
new NewThreadAction(new AcceptLoop(server),
|
new NewThreadAction(new AcceptLoop(server),
|
||||||
"TCP Accept-" + port, true));
|
"TCP Accept-" + port, true));
|
||||||
@ -350,6 +360,7 @@ public class TCPTransport extends Transport {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// otherwise verify security access to existing server socket
|
// otherwise verify security access to existing server socket
|
||||||
|
@SuppressWarnings("removal")
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
sm.checkListen(port);
|
sm.checkListen(port);
|
||||||
@ -646,11 +657,14 @@ public class TCPTransport extends Transport {
|
|||||||
private static final int POST = 0x504f5354;
|
private static final int POST = 0x504f5354;
|
||||||
|
|
||||||
/** most recently accept-authorized AccessControlContext */
|
/** most recently accept-authorized AccessControlContext */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private AccessControlContext okContext;
|
private AccessControlContext okContext;
|
||||||
/** cache of accept-authorized AccessControlContexts */
|
/** cache of accept-authorized AccessControlContexts */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private Map<AccessControlContext,
|
private Map<AccessControlContext,
|
||||||
Reference<AccessControlContext>> authCache;
|
Reference<AccessControlContext>> authCache;
|
||||||
/** security manager which authorized contexts in authCache */
|
/** security manager which authorized contexts in authCache */
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private SecurityManager cacheSecurityManager = null;
|
private SecurityManager cacheSecurityManager = null;
|
||||||
|
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
@ -669,6 +683,7 @@ public class TCPTransport extends Transport {
|
|||||||
* Verify that the given AccessControlContext has permission to
|
* Verify that the given AccessControlContext has permission to
|
||||||
* accept this connection.
|
* accept this connection.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
void checkAcceptPermission(SecurityManager sm,
|
void checkAcceptPermission(SecurityManager sm,
|
||||||
AccessControlContext acc)
|
AccessControlContext acc)
|
||||||
{
|
{
|
||||||
@ -694,6 +709,7 @@ public class TCPTransport extends Transport {
|
|||||||
okContext = acc;
|
okContext = acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
public void run() {
|
public void run() {
|
||||||
Thread t = Thread.currentThread();
|
Thread t = Thread.currentThread();
|
||||||
String name = t.getName();
|
String name = t.getName();
|
||||||
|
@ -45,15 +45,18 @@ import java.util.stream.Collectors;
|
|||||||
* The HotSpot implementation of com.sun.tools.attach.VirtualMachine.
|
* The HotSpot implementation of com.sun.tools.attach.VirtualMachine.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public abstract class HotSpotVirtualMachine extends VirtualMachine {
|
public abstract class HotSpotVirtualMachine extends VirtualMachine {
|
||||||
|
|
||||||
private static final long CURRENT_PID;
|
private static final long CURRENT_PID = pid();
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static long pid() {
|
||||||
|
PrivilegedAction<ProcessHandle> pa = () -> ProcessHandle.current();
|
||||||
|
return AccessController.doPrivileged(pa).pid();
|
||||||
|
}
|
||||||
|
|
||||||
private static final boolean ALLOW_ATTACH_SELF;
|
private static final boolean ALLOW_ATTACH_SELF;
|
||||||
static {
|
static {
|
||||||
PrivilegedAction<ProcessHandle> pa = ProcessHandle::current;
|
|
||||||
CURRENT_PID = AccessController.doPrivileged(pa).pid();
|
|
||||||
|
|
||||||
String s = VM.getSavedProperty("jdk.attach.allowAttachSelf");
|
String s = VM.getSavedProperty("jdk.attach.allowAttachSelf");
|
||||||
ALLOW_ATTACH_SELF = "".equals(s) || Boolean.parseBoolean(s);
|
ALLOW_ATTACH_SELF = "".equals(s) || Boolean.parseBoolean(s);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,6 @@ import static sun.nio.ch.sctp.ResultContainer.SHUTDOWN;
|
|||||||
/**
|
/**
|
||||||
* An implementation of an SctpChannel
|
* An implementation of an SctpChannel
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public class SctpChannelImpl extends SctpChannel
|
public class SctpChannelImpl extends SctpChannel
|
||||||
implements SelChImpl
|
implements SelChImpl
|
||||||
{
|
{
|
||||||
@ -188,6 +187,7 @@ public class SctpChannelImpl extends SctpChannel
|
|||||||
SctpNet.throwAlreadyBoundException();
|
SctpNet.throwAlreadyBoundException();
|
||||||
InetSocketAddress isa = (local == null) ?
|
InetSocketAddress isa = (local == null) ?
|
||||||
new InetSocketAddress(0) : Net.checkAddress(local);
|
new InetSocketAddress(0) : Net.checkAddress(local);
|
||||||
|
@SuppressWarnings("removal")
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
sm.checkListen(isa.getPort());
|
sm.checkListen(isa.getPort());
|
||||||
@ -358,6 +358,7 @@ public class SctpChannelImpl extends SctpChannel
|
|||||||
synchronized (sendLock) {
|
synchronized (sendLock) {
|
||||||
ensureOpenAndUnconnected();
|
ensureOpenAndUnconnected();
|
||||||
InetSocketAddress isa = Net.checkAddress(endpoint);
|
InetSocketAddress isa = Net.checkAddress(endpoint);
|
||||||
|
@SuppressWarnings("removal")
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm != null)
|
if (sm != null)
|
||||||
sm.checkConnect(isa.getAddress().getHostAddress(),
|
sm.checkConnect(isa.getAddress().getHostAddress(),
|
||||||
@ -1089,6 +1090,11 @@ public class SctpChannelImpl extends SctpChannel
|
|||||||
boolean unordered, int ppid) throws IOException;
|
boolean unordered, int ppid) throws IOException;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
loadSctpLibrary();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static void loadSctpLibrary() {
|
||||||
IOUtil.load(); /* loads nio & net native libraries */
|
IOUtil.load(); /* loads nio & net native libraries */
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<Void>() {
|
||||||
|
@ -40,8 +40,8 @@ import sun.nio.ch.Net;
|
|||||||
import com.sun.nio.sctp.SctpSocketOption;
|
import com.sun.nio.sctp.SctpSocketOption;
|
||||||
import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
|
import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public class SctpNet {
|
public class SctpNet {
|
||||||
|
@SuppressWarnings("removal")
|
||||||
private static final String osName = AccessController.doPrivileged(
|
private static final String osName = AccessController.doPrivileged(
|
||||||
(PrivilegedAction<String>) () -> System.getProperty("os.name"));
|
(PrivilegedAction<String>) () -> System.getProperty("os.name"));
|
||||||
|
|
||||||
@ -104,6 +104,7 @@ public class SctpNet {
|
|||||||
private static Set<SocketAddress> getRevealedLocalAddressSet(
|
private static Set<SocketAddress> getRevealedLocalAddressSet(
|
||||||
SocketAddress[] saa)
|
SocketAddress[] saa)
|
||||||
{
|
{
|
||||||
|
@SuppressWarnings("removal")
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
Set<SocketAddress> set = new HashSet<>(saa.length);
|
Set<SocketAddress> set = new HashSet<>(saa.length);
|
||||||
for (SocketAddress sa : saa) {
|
for (SocketAddress sa : saa) {
|
||||||
@ -113,7 +114,7 @@ public class SctpNet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static SocketAddress getRevealedLocalAddress(SocketAddress sa,
|
private static SocketAddress getRevealedLocalAddress(SocketAddress sa,
|
||||||
SecurityManager sm)
|
@SuppressWarnings("removal") SecurityManager sm)
|
||||||
{
|
{
|
||||||
if (sm == null || sa == null)
|
if (sm == null || sa == null)
|
||||||
return sa;
|
return sa;
|
||||||
@ -336,6 +337,11 @@ public class SctpNet {
|
|||||||
static native void init();
|
static native void init();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
loadSctpLibrary();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
private static void loadSctpLibrary() {
|
||||||
IOUtil.load(); // loads nio & net native libraries
|
IOUtil.load(); // loads nio & net native libraries
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<Void>() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user