jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1388000 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java test/java/org/apache/jackrabbit/oak/query/QueryTest.java test/resources/org/apache/jackrabbit/oak/query/xpath.txt
Date Thu, 20 Sep 2012 12:51:58 GMT
Author: thomasm
Date: Thu Sep 20 12:51:57 2012
New Revision: 1388000

URL: http://svn.apache.org/viewvc?rev=1388000&view=rev
Log:
OAK-322 XPath query is included in the exception message

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java?rev=1388000&r1=1387999&r2=1388000&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
Thu Sep 20 12:51:57 2012
@@ -86,7 +86,11 @@ public class QueryEngineImpl {
             XPathToSQL2Converter converter = new XPathToSQL2Converter();
             String sql2 = converter.convert(statement);
             SQL2Parser parser = new SQL2Parser(vf);
-            q = parser.parse(sql2);
+            try {
+                q = parser.parse(sql2);
+            } catch (ParseException e) {
+                throw new ParseException(statement + " converted to SQL-2 " + e.getMessage(),
0);
+            }
         } else {
             throw new ParseException("Unsupported language: " + language, 0);
         }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java?rev=1388000&r1=1387999&r2=1388000&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
Thu Sep 20 12:51:57 2012
@@ -134,12 +134,16 @@ public class QueryTest extends AbstractQ
                 } else if (line.startsWith("select") ||
                         line.startsWith("explain") ||
                         line.startsWith("measure") ||
-                        line.startsWith("sql1")) {
+                        line.startsWith("sql1") ||
+                        line.startsWith("xpath")) {
                     w.println(line);
                     String language = QueryEngineImpl.SQL2;
-                    if (line.startsWith("sql1")) {
+                    if (line.startsWith("sql1 ")) {
                         language = QueryEngineImpl.SQL;
                         line = line.substring("sql1 ".length());
+                    } else if (line.startsWith("xpath ")) {
+                        language = QueryEngineImpl.XPATH;
+                        line = line.substring("xpath ".length());
                     }
                     boolean readEnd = true;
                     for (String resultLine : executeQuery(line, language)) {

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt?rev=1388000&r1=1387999&r2=1388000&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt
Thu Sep 20 12:51:57 2012
@@ -25,6 +25,9 @@
 
 # jackrabbit test queries
 
+xpath /jcr:root/testroot//*[0]
+java.text.ParseException: /jcr:root/testroot//*[0] converted to SQL-2 Query: select [jcr:path],
[jcr:score], * from [nt:base] as a where 0(*)is not null and isdescendantnode(a, '/testroot');
expected: NOT, (
+
 xpath2sql /test
 select [jcr:path], [jcr:score], * from [nt:base] as a where name(a) = 'test' and issamenode(a,
'/')
 



Mime
View raw message