Skip to content

Commit

Permalink
Change java_lang_Throwable::create_initialization_error to create a '…
Browse files Browse the repository at this point in the history
…char *' message without using a Symbol.
  • Loading branch information
jianglizhou committed Jul 19, 2023
1 parent b5b6f4e commit e2223f0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/hotspot/share/classfile/javaClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2760,16 +2760,25 @@ Handle java_lang_Throwable::create_initialization_error(JavaThread* current, Han
// symbolic stacktrace of 'throwable'.
assert(throwable.not_null(), "shouldn't be");

// Now create the message from the original exception and thread name.
Symbol* message = java_lang_Throwable::detail_message(throwable());
ResourceMark rm(current);
char *message = nullptr;
{
PreserveExceptionMark pm(current);
oop detailed_message = java_lang_Throwable::message(throwable());
Handle message_handle(current, detailed_message);
if (detailed_message != nullptr) {
message = java_lang_String::as_platform_dependent_str(message_handle, current);
}
}

// Now create the message from the original exception and thread name.
stringStream st;
st.print("Exception %s%s ", throwable()->klass()->name()->as_klass_external_name(),
message == nullptr ? "" : ":");
if (message == nullptr) {
st.print("[in thread \"%s\"]", current->name());
} else {
st.print("%s [in thread \"%s\"]", message->as_C_string(), current->name());
st.print("%s [in thread \"%s\"]", message, current->name());
}

Symbol* exception_name = vmSymbols::java_lang_ExceptionInInitializerError();
Expand Down

0 comments on commit e2223f0

Please sign in to comment.