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

Mike Duigou mike.duigou at oracle.com
Mon Jun 17 19:52:46 UTC 2013


On Jun 12 2013, at 16:45 , Brian Burkhalter wrote:

> As no consensus was achieved, I am following up on this thread from last month
> 
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-May/017493.html
> 
> The behavior with and without the initially suggested patch http://cr.openjdk.java.net/~bpb/8015395/ for a few examples is listed below. As may be seen, the change suppresses the exception for bad values of the java.lang.Integer.IntegerCache.high property passed on the command line (silently falls back to the default value), but appears not to affect the behavior of the AutoBoxCacheMax property for these same values.
> 
> There was more support expressed in the thread last month for throwing the NumberFormatExceotion rather than ignoring the bad value and falling back silently to the default. I tend to agree with that approach in general, but I think that the question here is really whether the same logic applies to a property such as java.lang.Integer.IntegerCache.high which is not publicly supported but rather intended to be used as an internal conduit.

That the property is not publicly supported is important. The property is supposed to be set only by one user and we can adequately test that usage. Having started with the source I was unaware that the "correct" way to adjust the cache was to use the -XX:AutoBoxCacheMax option!

> Brian
> 
> --- WITH Patch ---
> 
> $ java -Xint -Djava.lang.Integer.IntegerCache.high=888888888888888888888888888 GoodbyeWorld
> Goodbye Cruel World! 
> 
> $ java -Xint -Djava.lang.Integer.IntegerCache.high=1024\-Xmx2g GoodbyeWorld
> Goodbye Cruel World! 
> 
> $ java -Xint -XX:AutoBoxCacheMax=888888888888888888888888888 GoodbyeWorld
> Goodbye Cruel World! 
> 
> $ java -Xint -XX:AutoBoxCacheMax=1024\-Xmx2g GoodbyeWorld
> Improperly specified VM option 'AutoBoxCacheMax=1024-Xmx2g'
> Error: Could not create the Java Virtual Machine.
> Error: A fatal exception has occurred. Program will exit

I am OK with this outcome. I would still prefer to see an error for the "AutoBoxCacheMax=888888888888888888888888888" case but can live with this result.

Mike




More information about the core-libs-dev mailing list