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 19:54:13 UTC 2013

So if an InternalError were to be used instead, the code would be like:

                try {
                    int i = parseInt(integerCacheHighPropValue);
                    i = Math.max(i, 127);
                    // Maximum array size is Integer.MAX_VALUE
                    h = Math.min(i, Integer.MAX_VALUE - (-low) -1);
                } catch(NumberFormatException nfe) {
                    // Recast the exception to an InternalError with a sensible message.
                    throw new InternalError(nfe.toString() +
                            ": cannot parse value specified for java.lang.Integer.IntegerCache.high property");

But that avoids the real question here, which is whether VM startup should be prevented by the value supplied for an internal property not being able to be parsed.


On May 29, 2013, at 11:49 AM, Brian Burkhalter wrote:

> Problem is that the String in the NumberFormatException in this case does not contain the reason, only the offending String. The parseInt() would need to be changed accordingly to make this intelligible.
> I have no strong preference but it does not seem to me that failing to start the VM is a great plan.

More information about the core-libs-dev mailing list