hotspot/src/share/vm/prims/jvm.cpp
changeset 18065 7d53ab28f937
parent 18063 3a0a5b11ab14
parent 17826 9ad5cd464a75
child 18066 b4b1f65075e5
equal deleted inserted replaced
18064:f8b62de095bf 18065:7d53ab28f937
  1070   if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) {
  1070   if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) {
  1071     // There are no signers for primitive types
  1071     // There are no signers for primitive types
  1072     return NULL;
  1072     return NULL;
  1073   }
  1073   }
  1074 
  1074 
  1075   Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
  1075   objArrayOop signers = java_lang_Class::signers(JNIHandles::resolve_non_null(cls));
  1076   objArrayOop signers = NULL;
       
  1077   if (k->oop_is_instance()) {
       
  1078     signers = InstanceKlass::cast(k)->signers();
       
  1079   }
       
  1080 
  1076 
  1081   // If there are no signers set in the class, or if the class
  1077   // If there are no signers set in the class, or if the class
  1082   // is an array, return NULL.
  1078   // is an array, return NULL.
  1083   if (signers == NULL) return NULL;
  1079   if (signers == NULL) return NULL;
  1084 
  1080 
  1100     // This call is ignored for primitive types and arrays.
  1096     // This call is ignored for primitive types and arrays.
  1101     // Signers are only set once, ClassLoader.java, and thus shouldn't
  1097     // Signers are only set once, ClassLoader.java, and thus shouldn't
  1102     // be called with an array.  Only the bootstrap loader creates arrays.
  1098     // be called with an array.  Only the bootstrap loader creates arrays.
  1103     Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
  1099     Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
  1104     if (k->oop_is_instance()) {
  1100     if (k->oop_is_instance()) {
  1105       InstanceKlass::cast(k)->set_signers(objArrayOop(JNIHandles::resolve(signers)));
  1101       java_lang_Class::set_signers(k->java_mirror(), objArrayOop(JNIHandles::resolve(signers)));
  1106     }
  1102     }
  1107   }
  1103   }
  1108 JVM_END
  1104 JVM_END
  1109 
  1105 
  1110 
  1106 
  1117   if (java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
  1113   if (java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
  1118     // Primitive types does not have a protection domain.
  1114     // Primitive types does not have a protection domain.
  1119     return NULL;
  1115     return NULL;
  1120   }
  1116   }
  1121 
  1117 
  1122   Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
  1118   oop pd = java_lang_Class::protection_domain(JNIHandles::resolve(cls));
  1123   return (jobject) JNIHandles::make_local(env, k->protection_domain());
  1119   return (jobject) JNIHandles::make_local(env, pd);
  1124 JVM_END
  1120 JVM_END
  1125 
  1121 
  1126 
  1122 
  1127 // Obsolete since 1.2 (Class.setProtectionDomain removed), although
  1123 // Obsolete since 1.2 (Class.setProtectionDomain removed), although
  1128 // still defined in core libraries as of 1.5.
  1124 // still defined in core libraries as of 1.5.
  1137 
  1133 
  1138     // cls won't be an array, as this called only from ClassLoader.defineClass
  1134     // cls won't be an array, as this called only from ClassLoader.defineClass
  1139     if (k->oop_is_instance()) {
  1135     if (k->oop_is_instance()) {
  1140       oop pd = JNIHandles::resolve(protection_domain);
  1136       oop pd = JNIHandles::resolve(protection_domain);
  1141       assert(pd == NULL || pd->is_oop(), "just checking");
  1137       assert(pd == NULL || pd->is_oop(), "just checking");
  1142       InstanceKlass::cast(k)->set_protection_domain(pd);
  1138       java_lang_Class::set_protection_domain(k->java_mirror(), pd);
  1143     }
  1139     }
  1144   }
  1140   }
  1145 JVM_END
  1141 JVM_END
  1146 
  1142 
  1147 static bool is_authorized(Handle context, instanceKlassHandle klass, TRAPS) {
  1143 static bool is_authorized(Handle context, instanceKlassHandle klass, TRAPS) {