提交 ce6739da 编写于 作者: R robm

8180881: Better packaging of deserialization

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