Skip to content
Permalink
Browse files
8243290: Improve diagnostic messages for class verification and redef…
…inition failures

Backport-of: ac46031
  • Loading branch information
Ekaterina Vergizova authored and Yuri Nesterenko committed Jan 29, 2021
1 parent fd622d3 commit a27970ff117b08cc51f71b70385c1553d1ddfced
Showing 2 changed files with 19 additions and 2 deletions.
@@ -125,8 +125,15 @@ void Verifier::trace_class_resolution(Klass* resolve_class, InstanceKlass* verif
void Verifier::log_end_verification(outputStream* st, const char* klassName, Symbol* exception_name, TRAPS) {
if (HAS_PENDING_EXCEPTION) {
st->print("Verification for %s has", klassName);
st->print_cr(" exception pending %s ",
oop message = java_lang_Throwable::message(PENDING_EXCEPTION);
if (message != NULL) {
char* ex_msg = java_lang_String::as_utf8_string(message);
st->print_cr(" exception pending '%s %s'",
PENDING_EXCEPTION->klass()->external_name(), ex_msg);
} else {
st->print_cr(" exception pending %s ",
PENDING_EXCEPTION->klass()->external_name());
}
} else if (exception_name != NULL) {
st->print_cr("Verification for %s failed", klassName);
}
@@ -1210,10 +1210,20 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) {
the_class->link_class(THREAD);
if (HAS_PENDING_EXCEPTION) {
Symbol* ex_name = PENDING_EXCEPTION->klass()->name();
log_info(redefine, class, load, exceptions)("link_class exception: '%s'", ex_name->as_C_string());
oop message = java_lang_Throwable::message(PENDING_EXCEPTION);
if (message != NULL) {
char* ex_msg = java_lang_String::as_utf8_string(message);
log_info(redefine, class, load, exceptions)("link_class exception: '%s %s'",
ex_name->as_C_string(), ex_msg);
} else {
log_info(redefine, class, load, exceptions)("link_class exception: '%s'",
ex_name->as_C_string());
}
CLEAR_PENDING_EXCEPTION;
if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) {
return JVMTI_ERROR_OUT_OF_MEMORY;
} else if (ex_name == vmSymbols::java_lang_NoClassDefFoundError()) {
return JVMTI_ERROR_INVALID_CLASS;
} else {
return JVMTI_ERROR_INTERNAL;
}

1 comment on commit a27970f

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on a27970f Jan 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.