You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "spark shen (JIRA)" <ji...@apache.org> on 2006/08/14 05:52:15 UTC

[jira] Updated: (HARMONY-1161) [classlib][luni] java.util.TreeMap.subMap(Object, Object).size() throws unspecified NPE.

     [ http://issues.apache.org/jira/browse/HARMONY-1161?page=all ]

spark shen updated HARMONY-1161:
--------------------------------

    Attachment: Harmony-1161.diff

Would you please try this patch?

Best regards
Spark Shen

> [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
>         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