RFR 8015395: NumberFormatException during startup if java.lang.Integer.IntegerCache.high set to bad value

Brian Burkhalter brian.burkhalter at oracle.com
Wed May 29 22:44:24 UTC 2013


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?

Brian


More information about the core-libs-dev mailing list