RFR 8015395: NumberFormatException during startup if java.lang.Integer.IntegerCache.high set to bad value
Remi Forax
forax at univ-mlv.fr
Wed May 29 23:40:03 UTC 2013
On 05/30/2013 12:44 AM, Brian Burkhalter wrote:
> On May 29, 2013, at 2:35 PM, Alan Bateman wrote:
>
>> It would be good to do a few experiments with -XX:AutoBoxCacheMax=<size> to make sure that bad values dp startup to fail, I expect they should.
> Yes, bad values do indeed cause startup to fail, for example:
>
> $ java -XX:AutoBoxCacheMax=1024\-Xmx2g HelloWorld
> Improperly specified VM option 'AutoBoxCacheMax=1024-Xmx2g'
> Error: Could not create the Java Virtual Machine.
> Error: A fatal exception has occurred. Program will exit.
>
>> As regards setting the property directly (which was never the intention and is not supported) then the issue is that the property value is being parsed lazily. If you want to check it early then it requires parsing it in VM.saveAndRemoveProperties, that is the method that is called early in the initialization to stash away these properties.
> Whether this property is parsed early or lazily it seems like the fundamental question remains: given a non-parseable value does one fall back to the default or throw an exception and prevent VM startup?
In Java, we are used too check arguments of a method and throws an
exception if something is wrong,
As a user of a method or here of the VM, it's far easier when the VM
stop otherwise you have to learn what is the default value that will be
used or worst what is the "smart" algorithm that will be used to recover
from this problem. That's not the good way to design
method/class/sofware, they are and should stay dumb, the intelligence
come from the way you connect the things, not from each piece.
>
> Brian
cheers,
Rémi
More information about the core-libs-dev
mailing list