harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r537764 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/ArrayList.java test/java/tests/api/java/util/ArrayListTest.java
Date Mon, 14 May 2007 09:48:38 GMT
Author: pyang
Date: Mon May 14 02:48:37 2007
New Revision: 537764

URL: http://svn.apache.org/viewvc?view=rev&rev=537764
Log:
Apply patch for HARMONY-3852( [classlib][luni] ArrayList does not throw ConcurrentModificationException
after calling sequence: ArrayList.trimToSize() & ArrayList.iterator().next())

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

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java?view=diff&rev=537764&r1=537763&r2=537764
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java Mon
May 14 02:48:37 2007
@@ -654,6 +654,7 @@
 		array = newArray;
 		firstIndex = 0;
 		lastIndex = array.length;
+		modCount = 0;
 	}
 
 	private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField(

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java?view=diff&rev=537764&r1=537763&r2=537764
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java
Mon May 14 02:48:37 2007
@@ -23,6 +23,8 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+import java.util.ConcurrentModificationException;
+import java.util.Vector;
 
 import tests.support.Support_ListTest;
 
@@ -489,6 +491,17 @@
 		for (int i = 0; i < alist.size(); i++)
 			assertTrue("Trimmed list contained incorrect elements", alist
 					.get(i) == objArray[i]);
+		Vector v = new Vector();
+		v.add("a");
+		ArrayList al = new ArrayList(v);
+		Iterator it = al.iterator();
+		al.trimToSize();
+		try {
+			it.next();
+			fail("should throw a ConcurrentModificationException");
+		} catch (ConcurrentModificationException ioobe) {
+			// expected
+		}
 	}
 
     /**



Mime
View raw message