harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r520779 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/TreeMap.java test/java/tests/api/java/util/TreeMapTest.java
Date Wed, 21 Mar 2007 07:14:32 GMT
Author: apetrenko
Date: Wed Mar 21 00:14:32 2007
New Revision: 520779

URL: http://svn.apache.org/viewvc?view=rev&rev=520779
Log:
Patch for HARMONY-2474 "[classlib][luni] java.util.TreeSet.remove() throw ClassCastException
while trying to remove element from empty TreeSet"

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

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java?view=diff&rev=520779&r1=520778&r2=520779
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java Wed
Mar 21 00:14:32 2007
@@ -1319,6 +1319,9 @@
 	 */
 	@Override
     public V remove(Object key) {
+		if (size == 0) {
+			return null;
+		}
 		Entry<K, V> node = find(key);
 		if (node == null) {
             return null;

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java?view=diff&rev=520779&r1=520778&r2=520779
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java
Wed Mar 21 00:14:32 2007
@@ -374,6 +374,10 @@
 
         tm = new TreeMap();
         assertNull(tm.put(new Integer(1), new Object()));
+
+        // regression for Harmony-2474
+        tm = new TreeMap();
+        tm.remove(o);
     }
 
     /**



Mime
View raw message