RFR: 8302491: NoClassDefFoundError omits the original cause of an error [v6]
David Holmes
dholmes at openjdk.org
Thu Mar 9 04:55:24 UTC 2023
On Tue, 7 Mar 2023 23:54:07 GMT, Ilarion Nakonechnyy <inakonechnyy at openjdk.org> wrote:
>> The proposed approach added a new function for getting the cause of an exception -`java_lang_Throwable::get_cause_simple `, that gets called within `InstanceKlass::add_initialization_error` if an old one `java_lang_Throwable::get_cause_with_stack_trace` didn't succeed because of an exception during the VM call. The simple function doesn't call the VM for getting a stack trace but fills in any other information about an exception.
>>
>> Besides that, the discovering information about an exception was added to `ConstantPoolCacheEntry::save_and_throw_indy_exc` function.
>>
>> Jtreg for reproducing the issue also was added to the commit.
>> The commit was tested with tier1 tests.
>
> Ilarion Nakonechnyy has updated the pull request incrementally with one additional commit since the last revision:
>
> Address a review notes
Two small adjustments needed and a couple of nits.
Thanks
src/hotspot/share/classfile/javaClasses.cpp line 2742:
> 2740: // not keep classes alive in the stack trace.
> 2741: // call this: public StackTraceElement[] getStackTrace()
> 2742: assert(throwable.not_null(), "shouldn't be");
You moved this assert but it needs to be before the first use of throwable()
src/hotspot/share/classfile/javaClasses.cpp line 2744:
> 2742: // symbolic stacktrace of 'throwable'.
> 2743:
> 2744: // Now create the message with the original exception and thread name.
Existing: s/with/from/
src/hotspot/share/classfile/javaClasses.cpp line 2759:
> 2757: Handle h_eiie = Exceptions::new_exception(current, exception_name, st.as_string());
> 2758: // If new_exception returns a different exception while creating the exception,
> 2759: // abandon the attempts to save the initialization error and return null.
Nit: s/attempts/attempt/
src/hotspot/share/oops/instanceKlass.cpp line 985:
> 983: Handle init_error = java_lang_Throwable::create_initialization_error(current, exception);
> 984:
> 985: if ( init_error.is_null()) {
Nit: extra space after (
src/hotspot/share/oops/instanceKlass.cpp line 986:
> 984:
> 985: if ( init_error.is_null()) {
> 986: log_trace(class, init)("Initialization error is null for class %s", external_name());
You need to move the ResourceMark from line 995 to line 984 to cover this new logging statement.
-------------
Changes requested by dholmes (Reviewer).
PR: https://git.openjdk.org/jdk/pull/12566
More information about the hotspot-dev
mailing list