Skip to content

Commit

Permalink
JCR-3401 Wrong results when querying with a DescendantSelfAxisQuery
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1371097 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
stillalex committed Aug 9, 2012
1 parent e588aeb commit 5b19588
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public int advance(int target) throws IOException {
return currentDoc;
}

currentDoc = subScorer.nextDoc();
currentDoc = subScorer.advance(target);
if (currentDoc == NO_MORE_DOCS) {
return NO_MORE_DOCS;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.jackrabbit.core.query;

import static org.apache.jackrabbit.JcrConstants.*;
import javax.jcr.Node;
import javax.jcr.RepositoryException;

Expand All @@ -29,4 +30,23 @@ public void testCaseTermQueryNPE() throws RepositoryException {
String xpathNPE = "//element(*,nt:unstructured)[fn:lower-case(@jcr:language)='en']//element(*,nt:unstructured)[@jcr:message]/(@jcr:key|@jcr:message)";
executeXPathQuery(xpathNPE, new Node[] {});
}

/**
* JCR-3401 Wrong results when querying with a DescendantSelfAxisQuery
*/
public void testNodeName() throws RepositoryException {
String name = "testNodeName" + System.currentTimeMillis();

Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
foo.addNode("branch1", NT_FOLDER).addNode(name, NT_FOLDER);
foo.addNode("branch2", NT_FOLDER).addNode(name, NT_FOLDER);
Node bar = testRootNode.addNode(name, NT_UNSTRUCTURED);

testRootNode.getSession().save();

executeXPathQuery("//element(*, nt:unstructured)[fn:name() = '" + name
+ "']", new Node[] { bar });
executeXPathQuery("//element(" + name + ", nt:unstructured)",
new Node[] { bar });
}
}

0 comments on commit 5b19588

Please sign in to comment.