You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/12/27 14:35:53 UTC

svn commit: r490502 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/TreeMap.java test/java/tests/api/java/util/TreeMapTest.java

Author: tellison
Date: Wed Dec 27 05:35:52 2006
New Revision: 490502

URL: http://svn.apache.org/viewvc?view=rev&rev=490502
Log:
Apply patch HARMONY-2849 ([classlib][luni]method TreeMap.headMap, not able to acquire a headmap from the endpoint of a submap)

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=490502&r1=490501&r2=490502
==============================================================================
--- 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 Dec 27 05:35:52 2006
@@ -335,7 +335,7 @@
                     if (hasStart && object.compareTo(startKey) < 0) {
                         throw new IllegalArgumentException();
                     }
-                    if (hasEnd && object.compareTo(endKey) >= 0) {
+                    if (hasEnd && object.compareTo(endKey) > 0) {
                         throw new IllegalArgumentException();
                     }
                 } else {
@@ -343,7 +343,7 @@
                             && backingMap.comparator().compare(key, startKey) < 0) {
                         throw new IllegalArgumentException();
                     }
-                    if (hasEnd && backingMap.comparator().compare(key, endKey) >= 0) {
+                    if (hasEnd && backingMap.comparator().compare(key, endKey) > 0) {
                         throw new IllegalArgumentException();
                     }
                 }

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=490502&r1=490501&r2=490502
==============================================================================
--- 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 Dec 27 05:35:52 2006
@@ -322,8 +322,11 @@
         };
 
         TreeMap<String, String> treemap = new TreeMap<String, String>(c);
-        treemap.put("key", "value"); //$NON-NLS-1$ //$NON-NLS-2$
         assertEquals(0, treemap.headMap(null).size());
+        
+        treemap = new TreeMap();
+		SortedMap<String, String> headMap =  treemap.headMap("100");
+		headMap.headMap("100");
     }
 
     /**