Tapestry
  1. Tapestry
  2. TAPESTRY-1065

TreeDataView.renderComponent() and TreeTableDataView.generateNodeList() cause ClassCastException in ITreeDataModel.getUniqueKey()

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.2
    • Fix Version/s: 4.1.2
    • Component/s: Contrib
    • Labels:
      None
    • Environment:
      Tapestry 4.0.2
      Java 1.5
      Windows XP

      Description

      TreeDataView.renderComponent() calls ITreeDataModel.getUniqueKey() with a root node object when it should be passing in a rootUID object (line 86 in TreeDataView.java):

      Object objChildUID = objTreeModel.getTreeDataModel()
      .getUniqueKey(objChild, objRoot);

      Instead of objRoot, objRootUID should be used, which has already been fetched on line 62:

      Object objRoot = objTreeDataModel.getRoot();
      Object objRootUID = objTreeDataModel.getUniqueKey(objRoot, null);

      This causes a ClassCastException on line 80 of SimpleTreeDataModel.getUniqueKey():

      TreePath objPath = (TreePath)objParentUniqueKey;

      SimpleTreeDataModel implements ITreeDataModel correctly (which specifies that a parent UID is to be passed into getUniqueKey() rather than a parent node), and other callers to ITreeDataModel.getUniqueKey() pass in a parent UID, so I believe this is a straightforward bug in TreeDataView and TreeTableDataView.

      The same bug exists in TreeTableDataView.generateNodeList() on line 117:
      Object objChildUID = objTreeModel.getTreeDataModel().getUniqueKey(
      objChild,
      objRoot);

        Activity

        Ryan Holmes created issue -
        Jesse Kuhnert made changes -
        Field Original Value New Value
        Fix Version/s 4.1.2 [ 12312202 ]
        Jesse Kuhnert made changes -
        Resolution Fixed [ 1 ]
        Assignee Jesse Kuhnert [ jkuhnert ]
        Status Open [ 1 ] Resolved [ 5 ]
        Mark Thomas made changes -
        Workflow jira [ 12381706 ] Default workflow, editable Closed status [ 12568106 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12568106 ] jira [ 12590037 ]

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Ryan Holmes
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development