jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1431357 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/api/ main/java/org/apache/jackrabbit/oak/query/ main/java/org/apache/jackrabbit/oak/security/user/query/ test/java/org/apache/jackrabbit/oak/security/prin...
Date Thu, 10 Jan 2013 13:48:19 GMT
Author: thomasm
Date: Thu Jan 10 13:48:19 2013
New Revision: 1431357

URL: http://svn.apache.org/viewvc?rev=1431357&view=rev
Log:
OAK-546 Query: unexpected result on negative limit / offset

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/QueryEngine.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/XPathQueryBuilder.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalProviderImplTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/QueryEngine.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/QueryEngine.java?rev=1431357&r1=1431356&r2=1431357&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/QueryEngine.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/QueryEngine.java
Thu Jan 10 13:48:19 2013
@@ -52,8 +52,8 @@ public interface QueryEngine {
      *
      * @param statement the query statement
      * @param language the language
-     * @param limit the maximum result set size
-     * @param offset the number of rows to skip
+     * @param limit the maximum result set size (may not be negative)
+     * @param offset the number of rows to skip (may not be negative)
      * @param bindings the bind variable value bindings
      * @param namePathMapper the name and path mapper to use
      * @return the result

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=1431357&r1=1431356&r2=1431357&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 Jan 10 13:48:19 2013
@@ -138,6 +138,12 @@ public abstract class QueryEngineImpl im
     public Result executeQuery(String statement, String language, long limit,
             long offset, Map<String, ? extends PropertyValue> bindings,
             NamePathMapper namePathMapper) throws ParseException {
+        if (limit < 0) {
+            throw new IllegalArgumentException("Limit may not be negative, is: " + limit);
+        }
+        if (offset < 0) {
+            throw new IllegalArgumentException("Offset may not be negative, is: " + offset);
+        }
         Query q = parseQuery(statement, language);
         q.setRootTree(getRootTree());
         q.setRootState(getRootState());

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/XPathQueryBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/XPathQueryBuilder.java?rev=1431357&r1=1431356&r2=1431357&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/XPathQueryBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/XPathQueryBuilder.java
Thu Jan 10 13:48:19 2013
@@ -35,7 +35,7 @@ public class XPathQueryBuilder implement
     private boolean sortIgnoreCase;
     private Value bound;
     private long offset;
-    private long maxCount = -1;
+    private long maxCount = Long.MAX_VALUE;
 
     //-------------------------------------------------------< QueryBuilder >---
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalProviderImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalProviderImplTest.java?rev=1431357&r1=1431356&r2=1431357&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalProviderImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalProviderImplTest.java
Thu Jan 10 13:48:19 2013
@@ -16,6 +16,11 @@
  */
 package org.apache.jackrabbit.oak.security.principal;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -36,14 +41,8 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
-import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 /**
  * PrincipalProviderImplTest...
  */
@@ -102,7 +101,6 @@ public class PrincipalProviderImplTest e
         }
     }
 
-    @Ignore("OAK-545") // TODO: OAK-545
     @Test
     public void testFindUserPrincipal() throws Exception {
         User testUser = null;
@@ -131,7 +129,6 @@ public class PrincipalProviderImplTest e
         }
     }
 
-    @Ignore("OAK-545") // TODO: OAK-545
     @Test
     public void testFindGroupPrincipal() throws Exception {
         Group testGroup = null;
@@ -199,7 +196,6 @@ public class PrincipalProviderImplTest e
         assertResult(principalProvider, nameHints, EveryonePrincipal.NAME, PrincipalManager.SEARCH_TYPE_NOT_GROUP,
false);
     }
 
-    @Ignore("OAK-545") // TODO: OAK-545
     @Test
     public void testFindWithoutHint() throws Exception {
         User testUser = null;



Mime
View raw message