1119 oop pd = java_lang_Class::protection_domain(JNIHandles::resolve(cls)); |
1119 oop pd = java_lang_Class::protection_domain(JNIHandles::resolve(cls)); |
1120 return (jobject) JNIHandles::make_local(env, pd); |
1120 return (jobject) JNIHandles::make_local(env, pd); |
1121 JVM_END |
1121 JVM_END |
1122 |
1122 |
1123 |
1123 |
1124 // Obsolete since 1.2 (Class.setProtectionDomain removed), although |
|
1125 // still defined in core libraries as of 1.5. |
|
1126 JVM_ENTRY(void, JVM_SetProtectionDomain(JNIEnv *env, jclass cls, jobject protection_domain)) |
|
1127 JVMWrapper("JVM_SetProtectionDomain"); |
|
1128 if (JNIHandles::resolve(cls) == NULL) { |
|
1129 THROW(vmSymbols::java_lang_NullPointerException()); |
|
1130 } |
|
1131 if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) { |
|
1132 // Call is ignored for primitive types |
|
1133 Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls)); |
|
1134 |
|
1135 // cls won't be an array, as this called only from ClassLoader.defineClass |
|
1136 if (k->oop_is_instance()) { |
|
1137 oop pd = JNIHandles::resolve(protection_domain); |
|
1138 assert(pd == NULL || pd->is_oop(), "just checking"); |
|
1139 java_lang_Class::set_protection_domain(k->java_mirror(), pd); |
|
1140 } |
|
1141 } |
|
1142 JVM_END |
|
1143 |
|
1144 static bool is_authorized(Handle context, instanceKlassHandle klass, TRAPS) { |
1124 static bool is_authorized(Handle context, instanceKlassHandle klass, TRAPS) { |
1145 // If there is a security manager and protection domain, check the access |
1125 // If there is a security manager and protection domain, check the access |
1146 // in the protection domain, otherwise it is authorized. |
1126 // in the protection domain, otherwise it is authorized. |
1147 if (java_lang_System::has_security_manager()) { |
1127 if (java_lang_System::has_security_manager()) { |
1148 |
1128 |