Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-1065

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: 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);

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: