8344065: Remove SecurityManager uses from the java.datatransfer module
Reviewed-by: serb
This commit is contained in:
parent
db56266ad1
commit
99070658fd
@ -313,7 +313,6 @@ module java.base {
|
|||||||
java.desktop;
|
java.desktop;
|
||||||
exports sun.reflect.misc to
|
exports sun.reflect.misc to
|
||||||
java.desktop,
|
java.desktop,
|
||||||
java.datatransfer,
|
|
||||||
java.management,
|
java.management,
|
||||||
java.management.rmi,
|
java.management.rmi,
|
||||||
java.rmi,
|
java.rmi,
|
||||||
|
@ -45,7 +45,6 @@ import java.util.Collections;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import sun.datatransfer.DataFlavorUtil;
|
import sun.datatransfer.DataFlavorUtil;
|
||||||
import sun.reflect.misc.ReflectUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@code DataFlavor} provides meta information about data. {@code DataFlavor}
|
* A {@code DataFlavor} provides meta information about data. {@code DataFlavor}
|
||||||
@ -131,13 +130,6 @@ public class DataFlavor implements Externalizable, Cloneable {
|
|||||||
ClassLoader fallback)
|
ClassLoader fallback)
|
||||||
throws ClassNotFoundException
|
throws ClassNotFoundException
|
||||||
{
|
{
|
||||||
ReflectUtil.checkPackageAccess(className);
|
|
||||||
try {
|
|
||||||
@SuppressWarnings("removal")
|
|
||||||
SecurityManager sm = System.getSecurityManager();
|
|
||||||
if (sm != null) {
|
|
||||||
sm.checkPermission(new RuntimePermission("getClassLoader"));
|
|
||||||
}
|
|
||||||
ClassLoader loader = ClassLoader.getSystemClassLoader();
|
ClassLoader loader = ClassLoader.getSystemClassLoader();
|
||||||
try {
|
try {
|
||||||
// bootstrap class loader and system class loader if present
|
// bootstrap class loader and system class loader if present
|
||||||
@ -155,9 +147,6 @@ public class DataFlavor implements Externalizable, Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SecurityException exception) {
|
|
||||||
// ignore secured class loaders
|
|
||||||
}
|
|
||||||
return Class.forName(className, true, fallback);
|
return Class.forName(className, true, fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,8 +30,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.lang.ref.SoftReference;
|
import java.lang.ref.SoftReference;
|
||||||
import java.security.AccessController;
|
|
||||||
import java.security.PrivilegedAction;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -202,12 +200,8 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable {
|
|||||||
}
|
}
|
||||||
isMapInitialized = true;
|
isMapInitialized = true;
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
InputStream is = SystemFlavorMap.class.getResourceAsStream(
|
||||||
InputStream is = AccessController.doPrivileged(
|
|
||||||
(PrivilegedAction<InputStream>) () -> {
|
|
||||||
return SystemFlavorMap.class.getResourceAsStream(
|
|
||||||
"/sun/datatransfer/resources/flavormap.properties");
|
"/sun/datatransfer/resources/flavormap.properties");
|
||||||
});
|
|
||||||
if (is == null) {
|
if (is == null) {
|
||||||
throw new InternalError("Default flavor mapping not found");
|
throw new InternalError("Default flavor mapping not found");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user