RFR 8187222 : ClassLoader.getSystemClassLoader not clear if recursive initialization leads to ISE or unspecified error
mandy chung
mandy.chung at oracle.com
Fri Dec 1 16:33:28 UTC 2017
On 12/1/17 2:32 AM, Alan Bateman wrote:
> On 30/11/2017 22:57, mandy chung wrote:
>> :
>>
>> This is indeed a bug that should throw ISE when
>> ClassLoader.getSystemClassLoader is called during the initialization
>> of the system class loader, as the spec states.
>>
>> line 1921: I suggest to revise the message to make it clearer:
>> "getSystemClassLoader cannot be called during the system class
>> loader instantiation"
>>
>> In ClassLoader::initSystemClassLoader (line 1971), when the exception
>> is thrown via Constructor::newInstance, it would be good to the cause
>> of an InvocationTargetException like:
>>
>> + Throwable t = e;
>> + if (e instanceof InvocationTargetException) {
>> + t = e.getCause();
>> + }
>> + throw new Error(t.getMessage(), t);
> Better still might be for initSystemClassLoader to re-throw the cause
> so that it appears immediately after the "Error occurred during
> initialization of VM" message that the VM will fail with.
Yes that would be better.
Mandy
More information about the core-libs-dev
mailing list