7103957: NegativeArraySizeException while initializing class IntegerCache
authormchung
Wed, 09 Jan 2013 16:58:47 -0800
changeset 15016 ade8c8076c59
parent 15015 1ff7af181393
child 15017 f06faf784dde
7103957: NegativeArraySizeException while initializing class IntegerCache Reviewed-by: darcy, mchung Contributed-by: brian.burkhalter@oracle.com
jdk/src/share/classes/java/lang/Integer.java
--- a/jdk/src/share/classes/java/lang/Integer.java	Wed Jan 09 08:59:58 2013 -0500
+++ b/jdk/src/share/classes/java/lang/Integer.java	Wed Jan 09 16:58:47 2013 -0800
@@ -772,7 +772,7 @@
                 int i = parseInt(integerCacheHighPropValue);
                 i = Math.max(i, 127);
                 // Maximum array size is Integer.MAX_VALUE
-                h = Math.min(i, Integer.MAX_VALUE - (-low));
+                h = Math.min(i, Integer.MAX_VALUE - (-low) -1);
             }
             high = h;