< prev index next >

src/share/vm/classfile/classFileParser.cpp

Print this page




5539 
5540     // Create a symbol and update the anonymous class name.
5541     _class_name = SymbolTable::new_symbol(new_anon_name,
5542                                           (int)host_pkg_len + 1 + class_name_len,
5543                                           CHECK);
5544   }
5545 }
5546 
5547 // If the host class and the anonymous class are in the same package then do
5548 // nothing.  If the anonymous class is in the unnamed package then move it to its
5549 // host's package.  If the classes are in different packages then throw an IAE
5550 // exception.
5551 void ClassFileParser::fix_anonymous_class_name(TRAPS) {
5552   assert(_host_klass != NULL, "Expected an anonymous class");
5553 
5554   const jbyte* anon_last_slash = UTF8::strrchr(_class_name->base(),
5555                                                _class_name->utf8_length(), '/');
5556   if (anon_last_slash == NULL) {  // Unnamed package
5557     prepend_host_package_name(_host_klass, CHECK);
5558   } else {
5559     if (!InstanceKlass::is_same_class_package(_host_klass->class_loader(),
5560                                               _host_klass->name(),
5561                                               _host_klass->class_loader(),
5562                                               _class_name)) {
5563       ResourceMark rm(THREAD);
5564       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
5565         err_msg("Host class %s and anonymous class %s are in different packages",
5566         _host_klass->name()->as_C_string(), _class_name->as_C_string()));
5567     }
5568   }
5569 }
5570 
5571 static bool relax_format_check_for(ClassLoaderData* loader_data) {
5572   bool trusted = (loader_data->is_the_null_class_loader_data() ||
5573                   SystemDictionary::is_platform_class_loader(loader_data->class_loader()));
5574   bool need_verify =
5575     // verifyAll
5576     (BytecodeVerificationLocal && BytecodeVerificationRemote) ||
5577     // verifyRemote
5578     (!BytecodeVerificationLocal && BytecodeVerificationRemote && !trusted);
5579   return !need_verify;
5580 }
5581 
5582 ClassFileParser::ClassFileParser(ClassFileStream* stream,




5539 
5540     // Create a symbol and update the anonymous class name.
5541     _class_name = SymbolTable::new_symbol(new_anon_name,
5542                                           (int)host_pkg_len + 1 + class_name_len,
5543                                           CHECK);
5544   }
5545 }
5546 
5547 // If the host class and the anonymous class are in the same package then do
5548 // nothing.  If the anonymous class is in the unnamed package then move it to its
5549 // host's package.  If the classes are in different packages then throw an IAE
5550 // exception.
5551 void ClassFileParser::fix_anonymous_class_name(TRAPS) {
5552   assert(_host_klass != NULL, "Expected an anonymous class");
5553 
5554   const jbyte* anon_last_slash = UTF8::strrchr(_class_name->base(),
5555                                                _class_name->utf8_length(), '/');
5556   if (anon_last_slash == NULL) {  // Unnamed package
5557     prepend_host_package_name(_host_klass, CHECK);
5558   } else {
5559     if (!_host_klass->is_same_class_package(_host_klass->class_loader(), _class_name)) {



5560       ResourceMark rm(THREAD);
5561       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
5562         err_msg("Host class %s and anonymous class %s are in different packages",
5563         _host_klass->name()->as_C_string(), _class_name->as_C_string()));
5564     }
5565   }
5566 }
5567 
5568 static bool relax_format_check_for(ClassLoaderData* loader_data) {
5569   bool trusted = (loader_data->is_the_null_class_loader_data() ||
5570                   SystemDictionary::is_platform_class_loader(loader_data->class_loader()));
5571   bool need_verify =
5572     // verifyAll
5573     (BytecodeVerificationLocal && BytecodeVerificationRemote) ||
5574     // verifyRemote
5575     (!BytecodeVerificationLocal && BytecodeVerificationRemote && !trusted);
5576   return !need_verify;
5577 }
5578 
5579 ClassFileParser::ClassFileParser(ClassFileStream* stream,


< prev index next >