RFR 8015395: NumberFormatException during startup if java.lang.Integer.IntegerCache.high set to bad value (original) (raw)
Alan Bateman Alan.Bateman at oracle.com
Wed May 29 21:35:58 UTC 2013
- Previous message: RFR 8015395: NumberFormatException during startup if java.lang.Integer.IntegerCache.high set to bad value
- Next message: RFR 8015395: NumberFormatException during startup if java.lang.Integer.IntegerCache.high set to bad value
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 29/05/2013 20:54, Brian Burkhalter wrote:
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.MAXVALUE h = Math.min(i, Integer.MAXVALUE - (-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. Brian It would be good to do a few experiments with -XX:AutoBoxCacheMax= to make sure that bad values dp startup to fail, I expect they should.
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.
-Alan.
- Previous message: RFR 8015395: NumberFormatException during startup if java.lang.Integer.IntegerCache.high set to bad value
- Next message: RFR 8015395: NumberFormatException during startup if java.lang.Integer.IntegerCache.high set to bad value
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]