Uploaded image for project: 'Commons SCXML'
  1. Commons SCXML
  2. SCXML-89

Assign.execute() doesn't remove all children of oldNode (includes fix)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.8
    • 0.9
    • None
    • Ubuntu 7.10 (64 bit), JRE ia32-java6-sun-1.6.0.03

    Description

      This code, from Assign.execute(), seems to remove the oldNode child and then ask for its next sibling, which returns null. The result is to remove the first child, but leave the other children around, so that the result of "Assign" is a concatenation of all-but-one of the old nodes, followed by the new nodes.

      for (Node child = oldNode.getFirstChild();
         child != null;
         child = child.getNextSibling()) {
         oldNode.removeChild(child);
      }
      

      This (modified) code finds the next sibling before removal and produces the expected result.

      for (Node child = oldNode.getFirstChild(); child != null;) {
         Node nextChild = child.getNextSibling();
         oldNode.removeChild(child);
         child = nextChild;
      }
      

      I can supply a test case if that would be helpful.

      Attachments

        1. jira-89.diff
          11 kB
          joel truher

        Activity

          People

            Unassigned Unassigned
            joel.truher joel truher
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: