harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r547299 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/BitSet.java test/java/tests/api/java/util/BitSetTest.java
Date Thu, 14 Jun 2007 16:35:17 GMT
Author: tellison
Date: Thu Jun 14 09:35:16 2007
New Revision: 547299

URL: http://svn.apache.org/viewvc?view=rev&rev=547299
Log:
Apply patch HARMONY-4147 ([classlib][luni] java.util.BitSet(Integer.MAX_VALUE) throws unexpected
NegativeArraySizeException)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/BitSet.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/BitSetTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/BitSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/BitSet.java?view=diff&rev=547299&r1=547298&r2=547299
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/BitSet.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/BitSet.java Thu Jun
14 09:35:16 2007
@@ -100,7 +100,7 @@
         if (nbits < 0) {
             throw new NegativeArraySizeException();
         }
-        bits = new long[(nbits + ELM_SIZE - 1) >> OFFSET];
+        bits = new long[(nbits >> OFFSET) + ((nbits & RIGHT_BITS) > 0 ? 1 :
0)];
         actualArrayLength = 0;
         isLengthActual = true;
     }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/BitSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/BitSetTest.java?view=diff&rev=547299&r1=547298&r2=547299
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/BitSetTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/BitSetTest.java
Thu Jun 14 09:35:16 2007
@@ -62,6 +62,9 @@
 		} catch (NegativeArraySizeException e) {
 			// Correct behaviour
 		}
+
+        // Regression test for HARMONY-4147
+        new BitSet(Integer.MAX_VALUE);
 	}
 
 	/**



Mime
View raw message