RFR: 8302491: NoClassDefFoundError omits the original cause of an error [v2]
David Holmes
dholmes at openjdk.org
Tue Feb 21 12:31:27 UTC 2023
On Tue, 21 Feb 2023 11:29:10 GMT, Ilarion Nakonechnyy <inakonechnyy at openjdk.org> wrote:
>> If `new_exception` returns a different exception then you have already lost that. The `ExceptionInInitializerError` would have been replaced by some other exception object: most likely OOME or even another SOE?
>
> Is it poor, to report OOME or SOE as the cause, instead of `ExceptionInInitializerError`?
> Especially when the first call to `get_cause_with_stack_trace` already has returned null.
> Actually, this is the intention of the fix - to report the SOE as the cause of NCDFE.
If an exception happens during clinit then it is caught and set as the cause of an ExceptionInInitializerError and the class is marked as erroneous. Subsequent attempts to load the class should throw NCDFE with the EIIE as the cause.
Sorry I've now confused myself about exactly what the problem scenario is and how we are trying to fix it. The first attempt to call `get_cause_with_stack_trace` fails due to SOE - but what "cause" are we trying to get here and what exception are we trying to throw? I need to take a deeper look at this again tomorrow and get the control flow sorted out.
-------------
PR: https://git.openjdk.org/jdk/pull/12566
More information about the hotspot-dev
mailing list