Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2386

Node Iterator generated from Node.getNodes(relPath) returns unexpected child of different type


    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.2.0.Final
    • 4.1.0.Final
    • Common
    • None

      Call to parent.getNodes(relPath) returns a NodeIterator containing the children according to 'relPath'. Unfortunately, it also gets a sibling of a different type as well.

      For example, the Teiid SQL Sequencer in our Komodo project generates the following nodes:

               EXECUTE IMMEDIATE 'SELECT a1 FROM g WHERE a2 = 5' AS a1 string INTO #g
      				@tsql:value=SELECT a1 FROM g WHERE a2 = 5

      As can be seen, the node dynamicCommand contains a single node of relative path 'tsql:asColumns'.
      However, when visiting this tree the following is performed:

      Iterator<Node> asColumns = node.getNodes(refName);
      // where refName is 'tsql:asColumns'
      // Cycling the iterator
      while(asColumns.hasNext()) {
          Node asc = asColumns.next();
          System.out.println(asc.getName() + " - " + asc.getPath());
      // Prints out
      // tsqlasColumns - /EXECUTE IMMEDIATE 'SELECT a1 FROM g WHERE a2 = 5' AS a1 string INTO #g/tsql:dynamicCommand/tsqlasColumns
      // tsqlsql - /EXECUTE IMMEDIATE 'SELECT a1 FROM g WHERE a2 = 5' AS a1 string INTO #g/tsql:dynamicCommand/tsqlsql

      The first element from the iterator is correct while the second one is not. Will debug some more to try and understand why it is getting the sibling as well.

            hchiorean Horia Chiorean (Inactive)
            parichar@redhat.com Paul Richardson
            0 Vote for this issue
            2 Start watching this issue