harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Markov (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-2474) [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet
Date Fri, 22 Dec 2006 19:06:23 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-2474?page=all ]

Mikhail Markov updated HARMONY-2474:
------------------------------------

    Attachment: H-2474.patch

Here is the patch for the impl and unit-test.

> [classlib][luni] 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
>         Attachments: H-2474.patch
>
>
> 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