harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Ivanov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2474) java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet
Date Tue, 05 Dec 2006 15:37:21 GMT
java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty
TreeSet
-----------------------------------------------------------------------------------------------------

                 Key: HARMONY-2474
                 URL: http://issues.apache.org/jira/browse/HARMONY-2474
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Anton Ivanov
            Priority: Minor


While trying to remove element from empty TreeSet, ClassCastException is thrown.

Test to reproduce the problem:

import java.util.TreeSet;

public class EmptyTreeRemoveTest {

    public static void main(String[] args) {
        TreeSet ts = new TreeSet();
        Object node = new Object();
        
        try {
            ts.remove(node);
            System.out.println("PASSED");
        } catch (Exception e) {
            System.out.println("FAILED");
            e.printStackTrace();
        }
    }
}

Output on Harmony:

FAILED
java.lang.ClassCastException: java.lang.Object incompatible with java.lang.Comparable
        at java.util.TreeMap.toComparable(TreeMap.java:79)
        at java.util.TreeMap.find(TreeMap.java:98)
        at java.util.TreeMap.remove(TreeMap.java:1322)
        at java.util.TreeSet.remove(TreeSet.java:290)
        at TreeRemoveTest.main(TreeRemoveTest.java:10)

Output on RI:

PASSED

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