diff --git a/classpath/java/util/BitSet.java b/classpath/java/util/BitSet.java index 2b6ada1203..e45fbee355 100644 --- a/classpath/java/util/BitSet.java +++ b/classpath/java/util/BitSet.java @@ -105,9 +105,9 @@ public class BitSet implements Serializable, Cloneable { } } - private void enlarge(int newSize) { - if (bits == null || bits.length < newSize) { - long[] newBits = new long[newSize + 1]; + private void enlarge(int newPartition) { + if (bits == null || bits.length < (newPartition + 1)) { + long[] newBits = new long[newPartition + 1]; if (bits != null) { System.arraycopy(bits, 0, newBits, 0, bits.length); } diff --git a/test/BitsetTest.java b/test/BitsetTest.java index 6ffc28fb67..b28ab939c2 100644 --- a/test/BitsetTest.java +++ b/test/BitsetTest.java @@ -48,6 +48,10 @@ public class BitsetTest { assertEquals("after 100, 102 is empty", 102, bits.nextClearBit(100)); testFlip(); + + BitSet expandingSet = new BitSet(); + //should force us to have 3 partitions. + expandingSet.set(128); } private static void testFlip() {