3274
3275 Klass* preserve_this_klass; // for storing result across HandleMark
3276
3277 // release all handles when parsing is done
3278 { HandleMark hm(THREAD);
3279
3280 // Checks if name in class file matches requested name
3281 if (name != NULL && class_name != name) {
3282 ResourceMark rm(THREAD);
3283 Exceptions::fthrow(
3284 THREAD_AND_LOCATION,
3285 vmSymbols::java_lang_NoClassDefFoundError(),
3286 "%s (wrong name: %s)",
3287 name->as_C_string(),
3288 class_name->as_C_string()
3289 );
3290 return nullHandle;
3291 }
3292
3293 if (TraceClassLoadingPreorder) {
3294 tty->print("[Loading %s", name->as_klass_external_name());
3295 if (cfs->source() != NULL) tty->print(" from %s", cfs->source());
3296 tty->print_cr("]");
3297 }
3298
3299 u2 super_class_index = cfs->get_u2_fast();
3300 if (super_class_index == 0) {
3301 check_property(class_name == vmSymbols::java_lang_Object(),
3302 "Invalid superclass index %u in class file %s",
3303 super_class_index,
3304 CHECK_(nullHandle));
3305 } else {
3306 check_property(valid_cp_range(super_class_index, cp_size) &&
3307 is_klass_reference(cp, super_class_index),
3308 "Invalid superclass index %u in class file %s",
3309 super_class_index,
3310 CHECK_(nullHandle));
3311 // The class name should be legal because it is checked when parsing constant pool.
3312 // However, make sure it is not an array type.
3313 bool is_array = false;
3314 if (cp->tag_at(super_class_index).is_klass()) {
|
3274
3275 Klass* preserve_this_klass; // for storing result across HandleMark
3276
3277 // release all handles when parsing is done
3278 { HandleMark hm(THREAD);
3279
3280 // Checks if name in class file matches requested name
3281 if (name != NULL && class_name != name) {
3282 ResourceMark rm(THREAD);
3283 Exceptions::fthrow(
3284 THREAD_AND_LOCATION,
3285 vmSymbols::java_lang_NoClassDefFoundError(),
3286 "%s (wrong name: %s)",
3287 name->as_C_string(),
3288 class_name->as_C_string()
3289 );
3290 return nullHandle;
3291 }
3292
3293 if (TraceClassLoadingPreorder) {
3294 tty->print("[Loading %s", (name != NULL) ? name->as_klass_external_name() : "NoName");
3295 if (cfs->source() != NULL) tty->print(" from %s", cfs->source());
3296 tty->print_cr("]");
3297 }
3298
3299 u2 super_class_index = cfs->get_u2_fast();
3300 if (super_class_index == 0) {
3301 check_property(class_name == vmSymbols::java_lang_Object(),
3302 "Invalid superclass index %u in class file %s",
3303 super_class_index,
3304 CHECK_(nullHandle));
3305 } else {
3306 check_property(valid_cp_range(super_class_index, cp_size) &&
3307 is_klass_reference(cp, super_class_index),
3308 "Invalid superclass index %u in class file %s",
3309 super_class_index,
3310 CHECK_(nullHandle));
3311 // The class name should be legal because it is checked when parsing constant pool.
3312 // However, make sure it is not an array type.
3313 bool is_array = false;
3314 if (cp->tag_at(super_class_index).is_klass()) {
|