RFR: 8048190: NoClassDefFoundError omits original ExceptionInInitializerError [v2]

Coleen Phillimore coleenp at openjdk.java.net
Thu Aug 5 13:17:04 UTC 2021


On Thu, 5 Aug 2021 13:05:07 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/classfile/javaClasses.cpp line 2698:
>> 
>>> 2696:     st.print("%s in thread %s", message->as_C_string(), thread_name);
>>> 2697:   }
>>> 2698:   Handle h_cause = Exceptions::new_exception(THREAD, exception, st.as_string());
>> 
>> This can fail for many reasons, causing the returned exception to not be an instance of "exception" at all, but an exception that was thrown trying to create an instance of  "exception". If that happens we should just return NULL here.
>
> Yes, regarding your other comment about whether the original exception should be reloaded and reinitialized, and whether its initialization could be the cause of the original exception.  I'll try to find a creative solution here so that the most common cases are still supported because I think this would be a helpful feature most of the time.  If you have some ideas, let me know (either here or offline).  Thanks.

I wonder if I can use a predefined exception like ExceptionInInitializerError and put the original exception in with the message?

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

PR: https://git.openjdk.java.net/jdk/pull/4996


More information about the hotspot-dev mailing list