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

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

    XMLWordPrintable

Details

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

    Description

      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
                      @jcr:primaryType=nt:unstructured
      		tsql:dynamicCommand
      			@jcr:primaryType=nt:unstructured
      			@tsql:teiidVersion=8.0.0
      			@tsql:type=10
      			@jcr:mixinTypes=[tsql:dynamicCommand]
      			@tsql:asClauseSet=true
      			tsqlasColumns
      				@jcr:primaryType=nt:unstructured
      				@tsql:teiidVersion=8.0.0
      				@tsql:typeClass=STRING
      				@jcr:mixinTypes=[tsql:elementSymbol]
      				@tsql:shortName=a1
      				@tsql:name=a1
      			tsqlintoGroup
      				@jcr:primaryType=nt:unstructured
      				@tsql:teiidVersion=8.0.0
      				@jcr:mixinTypes=[tsql:groupSymbol]
      				@tsql:shortName=#g
      				@tsql:name=#g
      			tsqlsql
      				@jcr:primaryType=nt:unstructured
      				@tsql:teiidVersion=8.0.0
      				@tsql:typeClass=STRING
      				@jcr:mixinTypes=[tsql:constant]
      				@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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: