8155977: ObjectInputStream::resolveClass & resolveProxyClass for platform loader
authormchung
Thu, 12 May 2016 11:16:16 -0700
changeset 37870 ed05be00b50d
parent 37869 e0f538c1694c
child 37871 45c70a976569
8155977: ObjectInputStream::resolveClass & resolveProxyClass for platform loader Reviewed-by: acorn, alanb, chegar, dfuchs
hotspot/src/share/vm/prims/jvm.cpp
--- a/hotspot/src/share/vm/prims/jvm.cpp	Wed May 11 11:04:17 2016 +0200
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Thu May 12 11:16:16 2016 -0700
@@ -3387,14 +3387,14 @@
   return (!access.is_private() && InstanceKlass::cast(current_class)->is_same_class_package(field_class));
 }
 
-// Return the first non-null class loader up the execution stack, or null
-// if only code from the null class loader is on the stack.
+// Return the first user-defined class loader up the execution stack, or null
+// if only code from the bootstrap or platform class loader is on the stack.
 
 JVM_ENTRY(jobject, JVM_LatestUserDefinedLoader(JNIEnv *env))
   for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
     vfst.skip_reflection_related_frames(); // Only needed for 1.4 reflection
     oop loader = vfst.method()->method_holder()->class_loader();
-    if (loader != NULL) {
+    if (loader != NULL && !SystemDictionary::is_platform_class_loader(loader)) {
       return JNIHandles::make_local(env, loader);
     }
   }