jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject svn commit: r1355403 - /jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/mem/InMemBundlePersistenceManager.java
Date Fri, 29 Jun 2012 14:19:36 GMT
Author: unico
Date: Fri Jun 29 14:19:33 2012
New Revision: 1355403

URL: http://svn.apache.org/viewvc?rev=1355403&view=rev
Log:
JCR-3367 [backport] implement InMemBundlePM#getAllNodeIds correctly

Modified:
    jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/mem/InMemBundlePersistenceManager.java

Modified: jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/mem/InMemBundlePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/mem/InMemBundlePersistenceManager.java?rev=1355403&r1=1355402&r2=1355403&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/mem/InMemBundlePersistenceManager.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/mem/InMemBundlePersistenceManager.java
Fri Jun 29 14:19:33 2012
@@ -382,7 +382,7 @@ public class InMemBundlePersistenceManag
         }
         super.init(context);
         // initialize mem stores
-        bundleStore = new HashMap<NodeId, byte[]>(initialCapacity, loadFactor);
+        bundleStore = new LinkedHashMap<NodeId, byte[]>(initialCapacity, loadFactor);
         refsStore = new HashMap<NodeId, byte[]>(initialCapacity, loadFactor);
 
         // Choose a FileSystem for the BlobStore based on whether data is persistent or not

@@ -492,9 +492,19 @@ public class InMemBundlePersistenceManag
      * {@inheritDoc}
      */
     public List<NodeId> getAllNodeIds(NodeId after, int maxCount) throws ItemStateException,
RepositoryException {
-        // ignore after and count parameters.
-        List<NodeId> result = new ArrayList<NodeId>();
-        result.addAll(bundleStore.keySet());
+        final List<NodeId> result = new ArrayList<NodeId>();
+        boolean add = after == null;
+        int count = 0;
+        for (NodeId nodeId : bundleStore.keySet()) {
+            if (add) {
+                result.add(nodeId);
+                if (++count == maxCount) {
+                    break;
+                }
+            } else {
+                add = nodeId.equals(after);
+            }
+        }
         return result;
     }
 



Mime
View raw message