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:50:13 UTC

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

[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


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

        

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

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ 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

        

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

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1161?page=all ]

Paulex Yang closed HARMONY-1161.
--------------------------------


Verified by Spark.

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

        

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

Posted by "spark shen (JIRA)" <ji...@apache.org>.
     [ 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

        

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

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1161?page=all ]

Paulex Yang resolved HARMONY-1161.
----------------------------------

    Resolution: Fixed

Spark, patch applied at revision r431540, thanks a lot for this enhancement, please verify that the problem is fully fixed as you expected.


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

        

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

Posted by "spark shen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1161?page=comments#action_12428295 ] 
            
spark shen commented on HARMONY-1161:
-------------------------------------

Hi Paulex,

The fix looks fine. Thank you.

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