136 JavaThread* jthread = JavaThread::current(); |
136 JavaThread* jthread = JavaThread::current(); |
137 if (jthread->has_last_Java_frame()) { |
137 if (jthread->has_last_Java_frame()) { |
138 vframeStream vfst(jthread); |
138 vframeStream vfst(jthread); |
139 |
139 |
140 // scan up the stack skipping ClassLoader, AccessController and PrivilegedAction frames |
140 // scan up the stack skipping ClassLoader, AccessController and PrivilegedAction frames |
141 TempNewSymbol access_controller = SymbolTable::new_symbol("java/security/AccessController", CHECK); |
141 TempNewSymbol access_controller = SymbolTable::new_symbol("java/security/AccessController"); |
142 Klass* access_controller_klass = SystemDictionary::resolve_or_fail(access_controller, false, CHECK); |
142 Klass* access_controller_klass = SystemDictionary::resolve_or_fail(access_controller, false, CHECK); |
143 TempNewSymbol privileged_action = SymbolTable::new_symbol("java/security/PrivilegedAction", CHECK); |
143 TempNewSymbol privileged_action = SymbolTable::new_symbol("java/security/PrivilegedAction"); |
144 Klass* privileged_action_klass = SystemDictionary::resolve_or_fail(privileged_action, false, CHECK); |
144 Klass* privileged_action_klass = SystemDictionary::resolve_or_fail(privileged_action, false, CHECK); |
145 |
145 |
146 Method* last_caller = NULL; |
146 Method* last_caller = NULL; |
147 |
147 |
148 while (!vfst.at_end()) { |
148 while (!vfst.at_end()) { |
784 // It's impossible to create this class; the name cannot fit |
784 // It's impossible to create this class; the name cannot fit |
785 // into the constant pool. |
785 // into the constant pool. |
786 return NULL; |
786 return NULL; |
787 } |
787 } |
788 |
788 |
789 TempNewSymbol h_name = SymbolTable::new_symbol(name, CHECK_NULL); |
789 TempNewSymbol h_name = SymbolTable::new_symbol(name); |
790 Klass* k = SystemDictionary::resolve_or_null(h_name, CHECK_NULL); |
790 Klass* k = SystemDictionary::resolve_or_null(h_name, CHECK_NULL); |
791 if (k == NULL) { |
791 if (k == NULL) { |
792 return NULL; |
792 return NULL; |
793 } |
793 } |
794 |
794 |
808 // It's impossible to create this class; the name cannot fit |
808 // It's impossible to create this class; the name cannot fit |
809 // into the constant pool. |
809 // into the constant pool. |
810 THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name); |
810 THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name); |
811 } |
811 } |
812 |
812 |
813 TempNewSymbol h_name = SymbolTable::new_symbol(name, CHECK_NULL); |
813 TempNewSymbol h_name = SymbolTable::new_symbol(name); |
814 |
814 |
815 oop loader_oop = JNIHandles::resolve(loader); |
815 oop loader_oop = JNIHandles::resolve(loader); |
816 oop from_class = JNIHandles::resolve(caller); |
816 oop from_class = JNIHandles::resolve(caller); |
817 oop protection_domain = NULL; |
817 oop protection_domain = NULL; |
818 // If loader is null, shouldn't call ClassLoader.checkPackageAccess; otherwise get |
818 // If loader is null, shouldn't call ClassLoader.checkPackageAccess; otherwise get |
850 "Class name exceeds maximum length of %d: %s", |
850 "Class name exceeds maximum length of %d: %s", |
851 Symbol::max_length(), |
851 Symbol::max_length(), |
852 name); |
852 name); |
853 return 0; |
853 return 0; |
854 } |
854 } |
855 TempNewSymbol h_name = SymbolTable::new_symbol(name, CHECK_NULL); |
855 TempNewSymbol h_name = SymbolTable::new_symbol(name); |
856 oop from_class_oop = JNIHandles::resolve(from); |
856 oop from_class_oop = JNIHandles::resolve(from); |
857 Klass* from_class = (from_class_oop == NULL) |
857 Klass* from_class = (from_class_oop == NULL) |
858 ? (Klass*)NULL |
858 ? (Klass*)NULL |
859 : java_lang_Class::as_Klass(from_class_oop); |
859 : java_lang_Class::as_Klass(from_class_oop); |
860 oop class_loader = NULL; |
860 oop class_loader = NULL; |
931 "Class name exceeds maximum length of %d: %s", |
931 "Class name exceeds maximum length of %d: %s", |
932 Symbol::max_length(), |
932 Symbol::max_length(), |
933 name); |
933 name); |
934 return 0; |
934 return 0; |
935 } |
935 } |
936 class_name = SymbolTable::new_symbol(name, str_len, CHECK_NULL); |
936 class_name = SymbolTable::new_symbol(name, str_len); |
937 } |
937 } |
938 |
938 |
939 ResourceMark rm(THREAD); |
939 ResourceMark rm(THREAD); |
940 ClassFileStream st((u1*)buf, len, source, ClassFileStream::verify); |
940 ClassFileStream st((u1*)buf, len, source, ClassFileStream::verify); |
941 Handle class_loader (THREAD, JNIHandles::resolve(loader)); |
941 Handle class_loader (THREAD, JNIHandles::resolve(loader)); |
987 if (str_len > Symbol::max_length()) { |
987 if (str_len > Symbol::max_length()) { |
988 // It's impossible to create this class; the name cannot fit |
988 // It's impossible to create this class; the name cannot fit |
989 // into the constant pool. |
989 // into the constant pool. |
990 return NULL; |
990 return NULL; |
991 } |
991 } |
992 TempNewSymbol klass_name = SymbolTable::new_symbol(str, str_len, CHECK_NULL); |
992 TempNewSymbol klass_name = SymbolTable::new_symbol(str, str_len); |
993 |
993 |
994 // Security Note: |
994 // Security Note: |
995 // The Java level wrapper will perform the necessary security check allowing |
995 // The Java level wrapper will perform the necessary security check allowing |
996 // us to pass the NULL as the initiating class loader. |
996 // us to pass the NULL as the initiating class loader. |
997 Handle h_loader(THREAD, JNIHandles::resolve(loader)); |
997 Handle h_loader(THREAD, JNIHandles::resolve(loader)); |