Harmony
  1. Harmony
  2. HARMONY-2419

[classlib][swing] JTree.DynamicUtilTreeNode.clone() returns DefaultMutableTreeNode object

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0M15
    • Component/s: Classlib
    • Labels:
      None

      Description

      According to J2SE API 5.0 specifications of
      DefaultMutableTreeNode.clone() method: "Returns a shallow copy of this node;
      the new node has no parent or children and has a reference to the same user
      object, if any."
      javax.swing.JTree.DynamicUtilTreeNode.clone() returns
      javax.swing.tree.DefaultMutableTreeNode object while RI returns
      JTree.DynamicUtilTreeNode.

      Test for reprodicing:
      import junit.framework.TestCase;
      import javax.swing.*;

      public class Test extends TestCase {
      public void testcase1()

      { Object obj = new Object(); JTree.DynamicUtilTreeNode t = new JTree.DynamicUtilTreeNode(obj,obj); Object cl = t.clone(); assertEquals(t.getClass(), cl.getClass()); }

      }

      Output on Sun 1.5
      =================
      .
      Time: 0.219

      OK (1 test)

      Output on Harmony:
      ==================
      .F
      Time: 1.234
      There was 1 failure:
      1) testcase1(Test)junit.framework.AssertionFailedError: expected:<class
      javax.swing.JTree$DynamicUtilTreeNode> but was:<class java
      x.swing.tree.DefaultMutableTreeNode>
      at Test.testcase1(Test.java:10)
      at java.lang.reflect.VMReflection.invokeMethod(Native Method)

      FAILURES!!!
      Tests run: 1, Failures: 1, Errors: 0

        Activity

        Artem Aliev created issue -
        Paulex Yang made changes -
        Field Original Value New Value
        Summary [swing] JTree.DynamicUtilTreeNode.clone() returns DefaultMutableTreeNode object [classlib][swing] JTree.DynamicUtilTreeNode.clone() returns DefaultMutableTreeNode object
        Hide
        Sebb added a comment -

        The problem here is that the clone() method fails to call super.clone(), so subclasses don't have the correct class.

        Show
        Sebb added a comment - The problem here is that the clone() method fails to call super.clone(), so subclasses don't have the correct class.
        Tim Ellison made changes -
        Assignee Tim Ellison [ tellison ]
        Hide
        Tim Ellison added a comment -

        Fixed in Swing module at repo revision r953360.

        This has been open so long that I'm guessing Artem is no longer monitoring it. I'll close the defect and anyone can reopen it if required.

        Show
        Tim Ellison added a comment - Fixed in Swing module at repo revision r953360. This has been open so long that I'm guessing Artem is no longer monitoring it. I'll close the defect and anyone can reopen it if required.
        Tim Ellison made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 5.0M15 [ 12315054 ]
        Resolution Fixed [ 1 ]
        Tim Ellison made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Hudson added a comment -

        Integrated in Harmony-1.5-head-linux-x86_64 #840 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/840/)
        Apply fix for HARMONY-2419 ([classlib][swing] JTree.DynamicUtilTreeNode.clone() returns DefaultMutableTreeNode object)

        Show
        Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #840 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/840/ ) Apply fix for HARMONY-2419 ( [classlib] [swing] JTree.DynamicUtilTreeNode.clone() returns DefaultMutableTreeNode object)
        Hide
        Hudson added a comment -

        Integrated in Harmony-select-1.5-head-linux-x86_64 #28 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/28/)
        Apply fix for HARMONY-2419 ([classlib][swing] JTree.DynamicUtilTreeNode.clone() returns DefaultMutableTreeNode object)

        Show
        Hudson added a comment - Integrated in Harmony-select-1.5-head-linux-x86_64 #28 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/28/ ) Apply fix for HARMONY-2419 ( [classlib] [swing] JTree.DynamicUtilTreeNode.clone() returns DefaultMutableTreeNode object)

          People

          • Assignee:
            Tim Ellison
            Reporter:
            Artem Aliev
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development