提交 ce6739da 编写于 作者: R robm

8180881: Better packaging of deserialization

Reviewed-by: chegar, acorn
上级 450b4b6e
......@@ -278,7 +278,7 @@ SUNWprivate_1.1 {
Java_sun_misc_Version_getJvmVersionInfo;
Java_sun_misc_Version_getJvmSpecialVersion;
Java_sun_misc_VM_getThreadStateValues;
Java_sun_misc_VM_latestUserDefinedLoader;
Java_sun_misc_VM_latestUserDefinedLoader0;
Java_sun_misc_VM_initialize;
Java_sun_misc_VMSupport_initAgentProperties;
Java_sun_misc_VMSupport_getVMTemporaryDirectory;
......
......@@ -2329,10 +2329,11 @@ public class ObjectInputStream
int ndoubles);
/**
* Returns the first non-null class loader (not counting class loaders of
* generated reflection implementation classes) up the execution stack, or
* null if only code from the null class loader is on the stack. This
* method is also called via reflection by the following RMI-IIOP class:
* Returns first non-privileged class loader on the stack (excluding
* reflection generated frames) or the extension class loader if only
* class loaded by the boot class loader and extension class loader are
* found on the stack. This method is also called via reflection by the
* following RMI-IIOP class:
*
* com.sun.corba.se.internal.util.JDKClassLoader
*
......
......@@ -128,8 +128,6 @@ public class Launcher {
*/
public static ExtClassLoader getExtClassLoader() throws IOException
{
final File[] dirs = getExtDirs();
try {
// Prior implementations of this doPrivileged() block supplied
// aa synthesized ACC via a call to the private method
......@@ -138,6 +136,7 @@ public class Launcher {
return AccessController.doPrivileged(
new PrivilegedExceptionAction<ExtClassLoader>() {
public ExtClassLoader run() throws IOException {
final File[] dirs = getExtDirs();
int len = dirs.length;
for (int i = 0; i < len; i++) {
MetaIndex.registerDirectory(dirs[i]);
......
......@@ -26,6 +26,8 @@
package sun.misc;
import static java.lang.Thread.State.*;
import java.io.IOException;
import java.security.AccessControlException;
import java.util.Properties;
import java.util.HashMap;
import java.util.Map;
......@@ -399,10 +401,23 @@ public class VM {
private final static int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
/*
* Returns the first non-null class loader up the execution stack,
* or null if only code from the null class loader is on the stack.
* Returns first non-privileged class loader on the stack (excluding
* reflection generated frames) or the extension class loader if only
* class loaded by the boot class loader and extension class loader are
* found on the stack.
*/
public static native ClassLoader latestUserDefinedLoader();
public static native ClassLoader latestUserDefinedLoader0();
public static ClassLoader latestUserDefinedLoader() {
ClassLoader loader = latestUserDefinedLoader0();
if (loader != null) {
return loader;
}
try {
return Launcher.ExtClassLoader.getExtClassLoader();
} catch (IOException e) {
return null;
}
}
static {
initialize();
......
......@@ -255,8 +255,10 @@ public class MarshalInputStream extends ObjectInputStream {
}
/*
* Returns the first non-null class loader up the execution stack, or null
* if only code from the null class loader is on the stack.
* Returns first non-privileged class loader on the stack (excluding
* reflection generated frames) or the extension class loader if only
* class loaded by the boot class loader and extension class loader are
* found on the stack.
*/
private static ClassLoader latestUserDefinedLoader() {
return sun.misc.VM.latestUserDefinedLoader();
......
......@@ -112,7 +112,7 @@ Java_sun_misc_VM_getThreadStateValues(JNIEnv *env, jclass cls,
}
JNIEXPORT jobject JNICALL
Java_sun_misc_VM_latestUserDefinedLoader(JNIEnv *env, jclass cls) {
Java_sun_misc_VM_latestUserDefinedLoader0(JNIEnv *env, jclass cls) {
return JVM_LatestUserDefinedLoader(env);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册