-
Bug
-
Resolution: Done
-
Major
-
4.1.0.Final
-
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 @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 tsqlasColumns @jcr:primaryType=nt:unstructured @tsql:teiidVersion=8.0.0 @tsql:typeClass=STRING @jcr:mixinTypes=[tsql:elementSymbol] @tsql:shortName=a1 @tsql:name=a1 tsqlintoGroup @jcr:primaryType=nt:unstructured @tsql:teiidVersion=8.0.0 @jcr:mixinTypes=[tsql:groupSymbol] @tsql:shortName=#g @tsql:name=#g tsqlsql @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 // tsqlasColumns - /EXECUTE IMMEDIATE 'SELECT a1 FROM g WHERE a2 = 5' AS a1 string INTO #g/tsql:dynamicCommand/tsqlasColumns // tsqlsql - /EXECUTE IMMEDIATE 'SELECT a1 FROM g WHERE a2 = 5' AS a1 string INTO #g/tsql:dynamicCommand/tsqlsql
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.