You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Anton Ivanov (JIRA)" <ji...@apache.org> on 2006/12/05 16:37:21 UTC

[jira] Created: (HARMONY-2474) java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet

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

        

[jira] Updated: (HARMONY-2474) [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet

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

Alexei Zakharov updated HARMONY-2474:
-------------------------------------

    Summary: [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet  (was: java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet)

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

        

[jira] Updated: (HARMONY-2474) [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet

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

        

[jira] Assigned: (HARMONY-2474) [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet

Posted by "Alexey Petrenko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Petrenko reassigned HARMONY-2474:
----------------------------------------

    Assignee: Alexey Petrenko

> [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2474
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2474
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>         Assigned To: Alexey Petrenko
>            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.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-2474) [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet

Posted by "Alexey Petrenko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Petrenko resolved HARMONY-2474.
--------------------------------------

    Resolution: Fixed

NB: RI throws ClassCastExceptions when TreeSet is not empty. Harmony throws it in all cases.
So only empty TreeSet need special handling for Harmony.

The patch has been applied.
Please verify.


> [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2474
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2474
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>         Assigned To: Alexey Petrenko
>            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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-2474) [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov updated HARMONY-2474:
-------------------------------------

    Patch Info: [Patch Available]

> [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2474
>                 URL: https://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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-2474) [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet

Posted by "Mikhail Markov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12482860 ] 

Mikhail Markov commented on HARMONY-2474:
-----------------------------------------

Thanks, Alexey! The issue is resolved now.

> [classlib][luni] java.util.TreeSet.remove() throw ClassCastException while trying to remove element from empty TreeSet
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2474
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2474
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>         Assigned To: Alexey Petrenko
>            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.
-
You can reply to this email to add a comment to the issue online.