Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: core
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      489

      Description

      Under certain circumstances, TreeList leaves an extra virtual node in the node
      hierarchy. The end result is two nodes in the TreeList (one real, one virtual)
      that have identical paths.

      The following unit test demonstrates an issue:

      public void testDeletionIssues() {
      EventList<String> source = new BasicEventList<String>();
      TreeList<String> treeList = new TreeList<String>(source,
      COMPRESSED_CHARACTER_TREE_FORMAT, TreeList.NODES_START_EXPANDED);
      ListConsistencyListener<String> listConsistencyListener =
      ListConsistencyListener.install(treeList);
      listConsistencyListener.setPreviousElementTracked(false);

      source.add("A");
      source.add("AB");
      assertTreeStructure(treeList, new String[]

      { "A", "AB", });

      source.add(0, "A");
      source.remove(1);
      source.set(1, "AB");

      assertTreeStructure(treeList, new String[] { "A", "AB", }

      );

      }

        Activity

        Hide
        brands added a comment -

        I'm no TreeList expert, but I had a look though:

        In your test after line
        source.add(0, "A");
        you have the following tree structure: "A", "A", "AB" (all real nodes, where the
        second "A" is the parent of "AB")
        question: is this correct? Or should the structure be "A", "AB" at this point?

        Assuming it's correct, you then try to remove the second "A", which is the
        parent of "AB". What I could debug is, that the second "A" is turned into a
        virtual node, but stays in the tree structure because it's still the parent of
        "AB", e.g. the tree structure is still "A", "A", "AB".

        What's probably desirable is, that the remove(1) is successful and the first "A"
        becomes the new parent of "AB", but this "special" case is obviously not
        implemented.

        (As a side note, if you do a remove(0) instead of remove(1) the test passes.)

        But I think only Jesse can tell exactly what's happening or what should happen...

        Show
        brands added a comment - I'm no TreeList expert, but I had a look though: In your test after line source.add(0, "A"); you have the following tree structure: "A", "A", "AB" (all real nodes, where the second "A" is the parent of "AB") question: is this correct? Or should the structure be "A", "AB" at this point? Assuming it's correct, you then try to remove the second "A", which is the parent of "AB". What I could debug is, that the second "A" is turned into a virtual node, but stays in the tree structure because it's still the parent of "AB", e.g. the tree structure is still "A", "A", "AB". What's probably desirable is, that the remove(1) is successful and the first "A" becomes the new parent of "AB", but this "special" case is obviously not implemented. (As a side note, if you do a remove(0) instead of remove(1) the test passes.) But I think only Jesse can tell exactly what's happening or what should happen...

          People

          • Assignee:
            jessewilson
            Reporter:
            trumpetinc
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: