8269409: Post JEP 411 refactoring: core-libs with maximum covering > 10K

Reviewed-by: lancea, naoto
This commit is contained in:
Weijun Wang 2021-06-28 19:05:33 +00:00
parent d0d26f5c55
commit e9b2c058a4
21 changed files with 229 additions and 128 deletions

View file

@ -33,7 +33,6 @@ import java.util.Enumeration;
import java.util.Properties;
import java.util.StringTokenizer;
@SuppressWarnings("removal")
public class MimeTable implements FileNameMap {
/** Keyed by content type, returns MimeEntries */
private Hashtable<String, MimeEntry> entries
@ -44,28 +43,15 @@ public class MimeTable implements FileNameMap {
= new Hashtable<String, MimeEntry>();
// Will be reset if in the platform-specific data file
private static String tempFileTemplate;
static {
@SuppressWarnings("removal")
private static String tempFileTemplate =
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
tempFileTemplate =
System.getProperty("content.types.temp.file.template",
"/tmp/%s");
mailcapLocations = new String[] {
System.getProperty("user.mailcap"),
StaticProperty.userHome() + "/.mailcap",
"/etc/mailcap",
"/usr/etc/mailcap",
"/usr/local/etc/mailcap",
};
return null;
}
});
}
new java.security.PrivilegedAction<String>() {
public String run() {
return System.getProperty("content.types.temp.file.template",
"/tmp/%s");
}
});
private static final String filePreamble = "sun.net.www MIME content-types table";
private static final String fileMagic = "#" + filePreamble;
@ -77,6 +63,7 @@ public class MimeTable implements FileNameMap {
private static class DefaultInstanceHolder {
static final MimeTable defaultInstance = getDefaultInstance();
@SuppressWarnings("removal")
static MimeTable getDefaultInstance() {
return java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<MimeTable>() {
@ -220,7 +207,20 @@ public class MimeTable implements FileNameMap {
// For backward compatibility -- mailcap format files
// This is not currently used, but may in the future when we add ability
// 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() {
Properties entries = new Properties();
@ -388,6 +388,7 @@ public class MimeTable implements FileNameMap {
properties.put("temp.file.template", tempFileTemplate);
String tag;
// Perform the property security check for user.name
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPropertyAccess("user.name");

View file

@ -53,7 +53,6 @@ import sun.net.www.HeaderParser;
// policy in HttpURLConnection. A failure on baz.foo.com shouldn't
// uncache foo.com!
@SuppressWarnings("removal")
public abstract class AuthenticationInfo extends AuthCacheValue implements Cloneable {
@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
* behavior is switched off.
*/
static final boolean serializeAuth;
static {
serializeAuth = java.security.AccessController.doPrivileged(
@SuppressWarnings("removal")
static final boolean serializeAuth = java.security.AccessController.doPrivileged(
new sun.security.action.GetBooleanAction(
"http.auth.serializeRequests")).booleanValue();
}
/* AuthCacheValue: */

View file

@ -57,7 +57,6 @@ import sun.security.action.GetPropertyAction;
* <p>
* @since 1.8
*/
@SuppressWarnings("removal")
public final class ZoneInfoFile {
/**
@ -249,6 +248,11 @@ public final class ZoneInfoFile {
.privilegedGetProperty("sun.timezone.ids.oldmapping", "false")
.toLowerCase(Locale.ROOT);
USE_OLDMAPPING = (oldmapping.equals("yes") || oldmapping.equals("true"));
loadTZDB();
}
@SuppressWarnings("removal")
private static void loadTZDB() {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
try {