jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r939653 - in /jackrabbit/branches/2.0: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/IndexNodeResolver.java jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java
Date Fri, 30 Apr 2010 12:56:27 GMT
Author: jukka
Date: Fri Apr 30 12:56:26 2010
New Revision: 939653

URL: http://svn.apache.org/viewvc?rev=939653&view=rev
Log:
2.0: Merged revision 928888 (JCR-2588)

Modified:
    jackrabbit/branches/2.0/   (props changed)
    jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/IndexNodeResolver.java
    jackrabbit/branches/2.0/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java

Propchange: jackrabbit/branches/2.0/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr 30 12:56:26 2010
@@ -2,4 +2,4 @@
 /jackrabbit/sandbox/JCR-1456:774917-886178
 /jackrabbit/sandbox/JCR-2170:812417-816332
 /jackrabbit/sandbox/tripod-JCR-2209:795441-795863
-/jackrabbit/trunk:891595,891629,892253,892263,894150-894151,896408,896513,896532,896857,896870,896876,896908,896940,896942-896943,896969,896977,897071,897836,897842,897858,897935,897983,897992-897993,897996,898002,898042,898267,898325,898540,898677,898699,898701,898715,898872,899102,899181,899391,899393-899394,899583,899594,899643,900305,900310,900314,900453,900702,900736,900762-900763,900767,900782,901095,901122,901139,901144,901170,901176,901191,901193,901196,901216,901228,901285,902058,902062,926324
+/jackrabbit/trunk:891595,891629,892253,892263,894150-894151,896408,896513,896532,896857,896870,896876,896908,896940,896942-896943,896969,896977,897071,897836,897842,897858,897935,897983,897992-897993,897996,898002,898042,898267,898325,898540,898677,898699,898701,898715,898872,899102,899181,899391,899393-899394,899583,899594,899643,900305,900310,900314,900453,900702,900736,900762-900763,900767,900782,901095,901122,901139,901144,901170,901176,901191,901193,901196,901216,901228,901285,902058,902062,926324,928888

Modified: jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/IndexNodeResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/IndexNodeResolver.java?rev=939653&r1=939652&r2=939653&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/IndexNodeResolver.java
(original)
+++ jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/IndexNodeResolver.java
Fri Apr 30 12:56:26 2010
@@ -136,7 +136,7 @@ class IndexNodeResolver extends NodeReso
                 stmt.append(ISO9075.encode(pName));
                 if (exact) {
                     stmt.append("='");
-                    stmt.append(value);
+                    stmt.append(value.replaceAll("'", "''"));
                     stmt.append("'");
                 } else {
                     stmt.append(",'%");
@@ -161,7 +161,7 @@ class IndexNodeResolver extends NodeReso
             if (c == '\\') {
                 ret.append("\\\\");
             } else if (c == '\'') {
-                ret.append("\\'");
+                ret.append("''");
             } else {
                 ret.append(c);
             }

Modified: jackrabbit/branches/2.0/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java?rev=939653&r1=939652&r2=939653&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java
(original)
+++ jackrabbit/branches/2.0/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java
Fri Apr 30 12:56:26 2010
@@ -62,4 +62,47 @@ public class IndexNodeResolverTest exten
             save();
         }
     }
+
+    public void testFindNodesNonExactWithApostrophe()
+            throws NotExecutableException, RepositoryException {
+        UserImpl currentUser = getCurrentUser();
+        Value vs = superuser.getValueFactory().createValue("value ' with apostrophe");
+        currentUser.setProperty(propertyName1, vs);
+        save();
+
+        Name propName = ((SessionImpl) superuser).getQName(propertyName1);
+        try {
+            NodeResolver nr = createNodeResolver(currentUser.getNode().getSession());
+
+            NodeIterator result = nr.findNodes(propName, "value ' with apostrophe", UserConstants.NT_REP_USER,
false);
+            assertTrue("expected result", result.hasNext());
+            assertEquals(currentUser.getNode().getPath(), result.nextNode().getPath());
+            assertFalse("expected no more results", result.hasNext());
+        } finally {
+            currentUser.removeProperty(propertyName1);
+            save();
+        }
+    }
+
+
+    public void testFindNodesExactWithApostrophe()
+            throws NotExecutableException, RepositoryException {
+        UserImpl currentUser = getCurrentUser();
+        Value vs = superuser.getValueFactory().createValue("value ' with apostrophe");
+        currentUser.setProperty(propertyName1, vs);
+        save();
+
+        Name propName = ((SessionImpl) superuser).getQName(propertyName1);
+        try {
+            NodeResolver nr = createNodeResolver(currentUser.getNode().getSession());
+
+            NodeIterator result = nr.findNodes(propName, "value ' with apostrophe", UserConstants.NT_REP_USER,
true);
+            assertTrue("expected result", result.hasNext());
+            assertEquals(currentUser.getNode().getPath(), result.nextNode().getPath());
+            assertFalse("expected no more results", result.hasNext());
+        } finally {
+            currentUser.removeProperty(propertyName1);
+            save();
+        }
+    }
 }
\ No newline at end of file



Mime
View raw message