RFR: 8302491: NoClassDefFoundError omits the original cause of an error [v3]

Leonid Mesnik lmesnik at openjdk.org
Wed Feb 22 00:51:30 UTC 2023


On Tue, 21 Feb 2023 12:12:56 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 two additional commits since the last revision:
> 
>  - Get rid of redundant code -
>    merge get_cause_with_stack_trace and get_cause_simple
>  - Review corrections

test/hotspot/jtreg/runtime/ClassInitErrors/TestNoClassDefFoundCause.java line 38:

> 36: public class TestNoClassDefFoundCause {
> 37: 
> 38:     static class CrashWithSOE {

CrashWithSOE is confusing. The VM is not crashed but just throw SOE. Could you please rename it.

test/hotspot/jtreg/runtime/ClassInitErrors/TestNoClassDefFoundCause.java line 65:

> 63:     }
> 64: 
> 65:     private static void verify_stack(Throwable e, String cause) throws Exception {

Please use verifyStack instead of verify_stack.

-------------

PR: https://git.openjdk.org/jdk/pull/12566


More information about the hotspot-dev mailing list