harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulex Yang (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (HARMONY-1161) [classlib][luni] java.util.TreeMap.subMap(Object, Object).size() throws unspecified NPE.
Date Tue, 15 Aug 2006 03:51:17 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-1161?page=all ]

Paulex Yang reassigned HARMONY-1161:
------------------------------------

    Assignee: Paulex Yang

> [classlib][luni] java.util.TreeMap.subMap(Object, Object).size() throws unspecified NPE.
> ----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1161
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1161
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: spark shen
>         Assigned To: Paulex Yang
>         Attachments: Harmony-1161.diff
>
>
> java.util.TreeMap.subMap(Object, Object).size() throws unspecified NPE under
> certain case. Demonstrated below:
> Code snippet:
> class MockComparatorNullTolerable implements Comparator<String> {
>         public int compare(String o1, String o2) {
>             if( o1 == o2 ) {
>                 return 0;
>             }
>             if( null == o1 ) {
>                 return -1;
>             }
>             return o1.compareTo(o2);
>         }
>     }
>     public CollationKey getCollationKey(String arg0) {
>         return null;
>     }
>     public int hashCode() {
>         return 0;
>     }
> }
> public void test_subMapLjava_lang_ObjectLjava_lang_Object() {
>         TreeMap<String, String> map1 = new TreeMap<String, String>(new
> MockComparatorNullTolerable ());
>         map1.put("key1" , "value1");
>         map1.put(null, "value1");
>         SortedMap<String, String> subMap =  map1.subMap( null, "key1");
>         assertEquals("Size of subMap should be 1:", 1, subMapWithNull.size());
> }
> When subMap.size() is called on Harmony, a NullPointerException will be thrown
> out. But On RI, no such exception will be thrown out.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message