jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcel Reutegger (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (JCR-834) Ampersand In query constraint causes InvalidQueryException
Date Tue, 10 Apr 2007 07:37:32 GMT

     [ https://issues.apache.org/jira/browse/JCR-834?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Marcel Reutegger resolved JCR-834.
----------------------------------

    Resolution: Duplicate

> Ampersand In query constraint causes InvalidQueryException
> ----------------------------------------------------------
>
>                 Key: JCR-834
>                 URL: https://issues.apache.org/jira/browse/JCR-834
>             Project: Jackrabbit
>          Issue Type: Bug
>    Affects Versions: 1.2.3
>            Reporter: Noah Vihinen
>
> The following query causes an InvalidQueryException.
> //element(*, nt:unstructured)[@ampProp = 'x & y']
> The following test causes the subsequent stack trace.
>   @Test
>   public void testAmpersandConstraint() throws Exception
>   {
>     Credentials credentials = new SimpleCredentials("internal", "".toCharArray());
>     Session session = getMCRContext().getRepository().login(credentials);
>     Node testNode = session.getRootNode().addNode("test");
>     testNode.setProperty("ampProp", "x & y");
>     String statement = "//element(*, nt:unstructured)[@ampProp = 'x & y']";
>     Query query = session.getWorkspace().getQueryManager().createQuery(statement, "xpath");
>     NodeIterator nodes = query.execute().getNodes();
>     while(nodes.hasNext())
>     {
>       Node node = nodes.nextNode();
>       log.info("Found node with path " + node.getPath() + ".");
>     }
>   }
> javax.jcr.query.InvalidQueryException: Lexical error at line 1, column 56.  Encountered:
" " (32), after : "\'x &": Lexical error at line 1, column 56.  Encountered: " " (32),
after : "\'x &": Lexical error at line 1, column 56.  Encountered: " " (32), after : "\'x
&"
> 	at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.<init>(XPathQueryBuilder.java:268)
> 	at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.createQuery(XPathQueryBuilder.java:294)
> 	at org.apache.jackrabbit.core.query.xpath.QueryBuilder.createQueryTree(QueryBuilder.java:37)
> 	at org.apache.jackrabbit.core.query.QueryParser.parse(QueryParser.java:54)
> 	at org.apache.jackrabbit.core.query.lucene.QueryImpl.<init>(QueryImpl.java:123)
> 	at org.apache.jackrabbit.core.query.lucene.SearchIndex.createExecutableQuery(SearchIndex.java:348)
> 	at org.apache.jackrabbit.core.query.QueryImpl.init(QueryImpl.java:103)
> 	at org.apache.jackrabbit.core.SearchManager.createQuery(SearchManager.java:314)
> 	at org.apache.jackrabbit.core.query.QueryManagerImpl.createQuery(QueryManagerImpl.java:85)
> 	at net.maven.mcr.jackrabbit.JackrabbitTest.testAmpersandConstraint(JackrabbitTest.java:81)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
> 	at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
> 	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
> 	at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
> 	at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
> 	at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
> 	at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
> 	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
> 	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
> 	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.apache.jackrabbit.core.query.xpath.TokenMgrError: Lexical error at line
1, column 56.  Encountered: " " (32), after : "\'x &"
> 	at org.apache.jackrabbit.core.query.xpath.XPathTokenManager.getNextToken(XPathTokenManager.java:14546)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.jj_ntk(XPath.java:9187)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.UnaryExpr(XPath.java:3986)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.CastExpr(XPath.java:3935)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.CastableExpr(XPath.java:3898)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.TreatExpr(XPath.java:3861)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.InstanceofExpr(XPath.java:3824)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.IntersectExceptExpr(XPath.java:3748)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.UnionExpr(XPath.java:3672)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.MultiplicativeExpr(XPath.java:3586)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.AdditiveExpr(XPath.java:3510)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.RangeExpr(XPath.java:3451)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ComparisonExpr(XPath.java:3397)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.AndExpr(XPath.java:3290)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.OrExpr(XPath.java:3227)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ExprSingle(XPath.java:2214)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.Expr(XPath.java:2094)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.Predicate(XPath.java:5233)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.PredicateList(XPath.java:5203)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.AxisStep(XPath.java:4707)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.StepExpr(XPath.java:4597)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.RelativePathExpr(XPath.java:4511)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.PathExpr(XPath.java:4417)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ValueExpr(XPath.java:4125)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.UnaryExpr(XPath.java:4032)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.CastExpr(XPath.java:3935)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.CastableExpr(XPath.java:3898)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.TreatExpr(XPath.java:3861)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.InstanceofExpr(XPath.java:3824)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.IntersectExceptExpr(XPath.java:3748)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.UnionExpr(XPath.java:3672)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.MultiplicativeExpr(XPath.java:3586)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.AdditiveExpr(XPath.java:3510)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.RangeExpr(XPath.java:3451)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ComparisonExpr(XPath.java:3353)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.AndExpr(XPath.java:3290)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.OrExpr(XPath.java:3227)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ExprSingle(XPath.java:2214)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ForClause(XPath.java:2337)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.FLWORExpr(XPath.java:2233)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ExprSingle(XPath.java:2133)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.Expr(XPath.java:2094)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.QueryBody(XPath.java:2066)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.MainModule(XPath.java:512)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.Module(XPath.java:387)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.QueryList(XPath.java:151)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.XPath2(XPath.java:118)
> 	at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.<init>(XPathQueryBuilder.java:261)
> 	... 29 more
> org.apache.jackrabbit.core.query.xpath.TokenMgrError: Lexical error at line 1, column
56.  Encountered: " " (32), after : "\'x &"
> 	at org.apache.jackrabbit.core.query.xpath.XPathTokenManager.getNextToken(XPathTokenManager.java:14546)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.jj_ntk(XPath.java:9187)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.UnaryExpr(XPath.java:3986)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.CastExpr(XPath.java:3935)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.CastableExpr(XPath.java:3898)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.TreatExpr(XPath.java:3861)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.InstanceofExpr(XPath.java:3824)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.IntersectExceptExpr(XPath.java:3748)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.UnionExpr(XPath.java:3672)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.MultiplicativeExpr(XPath.java:3586)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.AdditiveExpr(XPath.java:3510)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.RangeExpr(XPath.java:3451)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ComparisonExpr(XPath.java:3397)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.AndExpr(XPath.java:3290)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.OrExpr(XPath.java:3227)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ExprSingle(XPath.java:2214)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.Expr(XPath.java:2094)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.Predicate(XPath.java:5233)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.PredicateList(XPath.java:5203)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.AxisStep(XPath.java:4707)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.StepExpr(XPath.java:4597)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.RelativePathExpr(XPath.java:4511)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.PathExpr(XPath.java:4417)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ValueExpr(XPath.java:4125)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.UnaryExpr(XPath.java:4032)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.CastExpr(XPath.java:3935)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.CastableExpr(XPath.java:3898)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.TreatExpr(XPath.java:3861)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.InstanceofExpr(XPath.java:3824)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.IntersectExceptExpr(XPath.java:3748)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.UnionExpr(XPath.java:3672)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.MultiplicativeExpr(XPath.java:3586)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.AdditiveExpr(XPath.java:3510)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.RangeExpr(XPath.java:3451)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ComparisonExpr(XPath.java:3353)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.AndExpr(XPath.java:3290)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.OrExpr(XPath.java:3227)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ExprSingle(XPath.java:2214)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ForClause(XPath.java:2337)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.FLWORExpr(XPath.java:2233)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.ExprSingle(XPath.java:2133)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.Expr(XPath.java:2094)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.QueryBody(XPath.java:2066)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.MainModule(XPath.java:512)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.Module(XPath.java:387)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.QueryList(XPath.java:151)
> 	at org.apache.jackrabbit.core.query.xpath.XPath.XPath2(XPath.java:118)
> 	at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.<init>(XPathQueryBuilder.java:261)
> 	at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.createQuery(XPathQueryBuilder.java:294)
> 	at org.apache.jackrabbit.core.query.xpath.QueryBuilder.createQueryTree(QueryBuilder.java:37)
> 	at org.apache.jackrabbit.core.query.QueryParser.parse(QueryParser.java:54)
> 	at org.apache.jackrabbit.core.query.lucene.QueryImpl.<init>(QueryImpl.java:123)
> 	at org.apache.jackrabbit.core.query.lucene.SearchIndex.createExecutableQuery(SearchIndex.java:348)
> 	at org.apache.jackrabbit.core.query.QueryImpl.init(QueryImpl.java:103)
> 	at org.apache.jackrabbit.core.SearchManager.createQuery(SearchManager.java:314)
> 	at org.apache.jackrabbit.core.query.QueryManagerImpl.createQuery(QueryManagerImpl.java:85)
> 	at net.maven.mcr.jackrabbit.JackrabbitTest.testAmpersandConstraint(JackrabbitTest.java:81)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
> 	at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
> 	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
> 	at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
> 	at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
> 	at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
> 	at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
> 	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
> 	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
> 	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message