changeset 6485:9cf3e367b99b

7103957: NegativeArraySizeException while initializing class IntegerCache Reviewed-by: darcy, mchung Contributed-by: brian.burkhalter@oracle.com
author mchung
date Wed, 09 Jan 2013 16:58:47 -0800
parents 85da6a7e9f85
children 552ab255158d
files src/share/classes/java/lang/Integer.java
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/Integer.java	Tue Feb 19 16:19:09 2013 +0000
+++ b/src/share/classes/java/lang/Integer.java	Wed Jan 09 16:58:47 2013 -0800
@@ -607,7 +607,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;