jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1393402 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query: Query.java ast/NodeNameImpl.java
Date Wed, 03 Oct 2012 10:50:11 GMT
Author: alexparvulescu
Date: Wed Oct  3 10:50:11 2012
New Revision: 1393402

URL: http://svn.apache.org/viewvc?rev=1393402&view=rev
Log:
OAK-328 jcr:like(fn:name(), '%:content') should not match jcr:content

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java?rev=1393402&r1=1393401&r2=1393402&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
Wed Oct  3 10:50:11 2012
@@ -474,7 +474,7 @@ public class Query {
             case PropertyType.DECIMAL:
                 return vf.createValue(v.getString(), PropertyType.DECIMAL);
             case PropertyType.NAME:
-                return vf.createValue(getOakPath(v.getString()), PropertyType.NAME);
+                return vf.createValue(getOakPath(v.getString(), true), PropertyType.NAME);
             case PropertyType.PATH:
                 return vf.createValue(v.getString(), PropertyType.PATH);
             case PropertyType.REFERENCE:
@@ -504,7 +504,7 @@ public class Query {
         }
     }
 
-    public String getOakPath(String jcrPath) {
+    public String getOakPath(String jcrPath, boolean errorOnInvalidPath) {
         NamePathMapper m = getNamePathMapper();
         if (m == null) {
             // to simplify testing, a getNamePathMapper isn't required
@@ -512,6 +512,9 @@ public class Query {
         }
         String p = m.getOakPath(jcrPath);
         if (p == null) {
+            if (!errorOnInvalidPath) {
+                return null;
+            }
             throw new IllegalArgumentException("Not a valid JCR path: " + jcrPath);
         }
         return p;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java?rev=1393402&r1=1393401&r2=1393402&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java
Wed Oct  3 10:50:11 2012
@@ -77,6 +77,10 @@ public class NodeNameImpl extends Dynami
         String path = v.getString();
         // Name escaping (convert _x0020_ to space)
         path = decodeName(path);
+        if (path == null) {
+            f.setAlwaysFalse();
+            return;
+        }
         if (PathUtils.isAbsolute(path)) {
             throw new IllegalArgumentException("NAME() comparison with absolute path are
not allowed: " + path);
         }
@@ -95,7 +99,7 @@ public class NodeNameImpl extends Dynami
         // Name escaping (convert _x0020_ to space)
         path = ISO9075.decode(path);
         // normalize paths (./name > name)
-        path = query.getOakPath(path);
+        path = query.getOakPath(path, false);
         return path;
     }
 



Mime
View raw message