You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by th...@apache.org on 2015/07/22 16:16:51 UTC

svn commit: r1692280 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java test/resources/org/apache/jackrabbit/oak/query/xpath.txt

Author: thomasm
Date: Wed Jul 22 14:16:51 2015
New Revision: 1692280

URL: http://svn.apache.org/r1692280
Log:
OAK-2864 XPath backwards compatibility issue with false() and true()

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.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/xpath/XPathToSQL2Converter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java?rev=1692280&r1=1692279&r2=1692280&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java Wed Jul 22 14:16:51 2015
@@ -497,8 +497,14 @@ public class XPathToSQL2Converter {
         if (readIf("@")) {
             return readProperty();
         } else if (readIf("true")) {
+            if (readIf("(")) {
+                read(")");
+            }
             return Expression.Literal.newBoolean(true);
         } else if (readIf("false")) {
+            if (readIf("(")) {
+                read(")");
+            }
             return Expression.Literal.newBoolean(false);
         } else if (currentTokenType == VALUE_NUMBER) {
             Expression.Literal l = Expression.Literal.newNumber(currentToken);

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=1692280&r1=1692279&r2=1692280&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 Wed Jul 22 14:16:51 2015
@@ -1184,6 +1184,24 @@ select [jcr:path], [jcr:score], *
   /* xpath ... */
 
 xpath2sql /jcr:root/etc/workflow//element(*,Item)
+  [not(meta/@archived) and not(meta/@archived = true())]
+select [jcr:path], [jcr:score], *
+  from [Item] as a
+  where [meta/archived] is null
+  and not([meta/archived] = true)
+  and isdescendantnode(a, '/etc/workflow')
+  /* xpath ... */
+
+xpath2sql /jcr:root/etc/workflow//element(*,Item)
+  [not(meta/@archived) and not(meta/@archived = false())]
+select [jcr:path], [jcr:score], *
+  from [Item] as a
+  where [meta/archived] is null
+  and not([meta/archived] = false)
+  and isdescendantnode(a, '/etc/workflow')
+  /* xpath ... */
+
+xpath2sql /jcr:root/etc/workflow//element(*,Item)
   [not(meta/@archived) and not(meta/@archived = true)]
 select [jcr:path], [jcr:score], *
   from [Item] as a