jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Mueller (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OAK-2864) XPath backwards compatibility issue with false() and true()
Date Wed, 22 Jul 2015 13:46:04 GMT

    [ https://issues.apache.org/jira/browse/OAK-2864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14636924#comment-14636924
] 

Thomas Mueller commented on OAK-2864:
-------------------------------------

Proposed patch:

{noformat}
--- src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt	(revision 1692233)
+++ src/test/resources/org/apache/jackrabbit/oak/query/xpath.txt	(working copy)
@@ -1184,6 +1184,24 @@
   /* 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
Index: src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java
===================================================================
--- src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java	(revision
1692233)
+++ src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java	(working
copy)
@@ -497,8 +497,14 @@
         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);
{noformat}

> XPath backwards compatibility issue with false() and true()
> -----------------------------------------------------------
>
>                 Key: OAK-2864
>                 URL: https://issues.apache.org/jira/browse/OAK-2864
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: query
>            Reporter: Julian Sedding
>            Assignee: Thomas Mueller
>             Fix For: 1.3.4
>
>
> In JR2 (actually CRX 2) both of the following queries for nodes with a
> boolean property can be parsed, however only query (a) returns search
> results.
> {noformat}
>     (a) /jcr:root/test//*[@foo = true()]
>     (b) /jcr:root/test//*[@foo = true]
> {noformat}
> On Oak 1.2, query (a) results in an exception\[0\] and query (b) returns
> search results.
> See discussion at http://markmail.org/thread/kpews55jpdwm62ds



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message