harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r474719 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/Hashtable.java test/java/tests/api/java/util/HashtableTest.java
Date Tue, 14 Nov 2006 10:20:21 GMT
Author: varlax
Date: Tue Nov 14 02:20:20 2006
New Revision: 474719

URL: http://svn.apache.org/viewvc?view=rev&rev=474719
Log:
Applied HARMONY-2181 [classlib][luni]Property fails to remove entry by iteration.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashtableTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java?view=diff&rev=474719&r1=474718&r2=474719
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
Tue Nov 14 02:20:20 2006
@@ -186,7 +186,7 @@
 								entry = entry.next;
 							}
 							if (entry != null) {
-								entry = lastEntry.next;
+								entry.next = lastEntry.next;
 								removed = true;
 							}
 						}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashtableTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashtableTest.java?view=diff&rev=474719&r1=474718&r2=474719
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashtableTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashtableTest.java
Tue Nov 14 02:20:20 2006
@@ -633,6 +633,28 @@
 				"Removing from the values collection should remove from the original map",
 				!myHashtable.containsValue(new Integer(0)));
 	}
+    
+    /**
+     * Regression Test for JIRA 2181
+     */
+    public void test_entrySet_remove()
+    {
+        Hashtable<String,String> hashtable = new Hashtable<String,String>();
+        hashtable.put("my.nonexistent.prop", "AAA");
+        hashtable.put( "parse.error", "BBB" );
+        Iterator<Map.Entry<String,String>> iterator = 
+            hashtable.entrySet().iterator();
+        while(iterator.hasNext())
+        {
+            Map.Entry entry = iterator.next();
+            final Object value = entry.getValue();           
+            if(value.equals("AAA"))
+            {
+               iterator.remove();
+            }
+        }
+        assertFalse(hashtable.containsKey("my.nonexistent.prop"));
+    }
 
 	protected Hashtable hashtableClone(Hashtable s) {
 		return (Hashtable) s.clone();



Mime
View raw message