RFR JDK-8209553: ExceptionInInitializerError can have a default detail message if the cause is given
mandy chung
mandy.chung at oracle.com
Tue Aug 21 04:31:08 UTC 2018
On 8/20/18 6:06 PM, David Holmes wrote:
>> If EIIE must have a detail message then that should just be something
>> explicit like:
>>
>> Caused by <cause exception type> : <cause detail message>
>
> This is of course what you actually propose by using cause.toString() -
> for some reason I was thinking you were just using the cause's detail
> message as the EIIE detail message. Sorry about that.
Yup, the proposed detail message for EIIE(Throwable cause) constructor
will have:
<cause exception type> : <cause detail message>
> I still don't think this change is actually necessary, but it's fine.
I see it's a small improvement for troubleshooting even people live
without it.
A related but different topic:
While digging up the exception chaining facility related issue,
I found that the private exception field was removed initially
but added back because of JDK-4385429 [1] that failed to deserialize
since the cause can't be re-initialized.
If I redo the fix for JDK-4385429 (essentially adding the package-
private Throwable::setCause), several other exception types such
as UndeclaredThrowableException and InvocationTargetException
will get the default detail message rather than null. Anyway,
just to mention that a few other exception types may have
similar change.
Mandy
[1] https://bugs.openjdk.java.net/browse/JDK-4385429
> Thanks,
> David
More information about the core-libs-dev
mailing list