jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1813337 - in /jackrabbit/branches/2.14: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java
Date Wed, 25 Oct 2017 18:38:16 GMT
Author: reschke
Date: Wed Oct 25 18:38:16 2017
New Revision: 1813337

URL: http://svn.apache.org/viewvc?rev=1813337&view=rev
Log:
JCR-3929: ConsistencyChecker now deals with empty repositories (ported to 2.14)

(thanks to pacuk.anton@gmail.com for investigating)

Modified:
    jackrabbit/branches/2.14/   (props changed)
    jackrabbit/branches/2.14/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java
    jackrabbit/branches/2.14/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java

Propchange: jackrabbit/branches/2.14/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 25 18:38:16 2017
@@ -1,3 +1,3 @@
 /jackrabbit/branches/JCR-2272:1173165-1176545
 /jackrabbit/sandbox/JCR-2415-lucene-3.0:1060860-1064038
-/jackrabbit/trunk:1776907,1776911-1776912,1776914,1776918,1779166,1779460,1779614,1779632,1780208,1780220,1780406,1785225,1786325,1786330,1787043,1787381,1792100,1792105,1792113,1792193,1793315,1793323,1793327,1793332,1793339,1796980,1797209,1797917,1798586,1799429,1799538,1799549,1799575,1800359,1800378,1800752,1802925,1802977,1807234,1807244,1808752,1808754,1809149,1809329,1809624,1811667,1812543,1812634
+/jackrabbit/trunk:1776907,1776911-1776912,1776914,1776918,1779166,1779460,1779614,1779632,1780208,1780220,1780406,1785225,1786325,1786330,1787043,1787381,1792100,1792105,1792113,1792193,1793315,1793323,1793327,1793332,1793339,1796980,1797209,1797917,1798586,1799429,1799538,1799549,1799575,1800359,1800378,1800752,1802925,1802977,1807234,1807244,1808752,1808754,1809149,1809329,1809624,1810108,1811667,1812543,1812634

Modified: jackrabbit/branches/2.14/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.14/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java?rev=1813337&r1=1813336&r2=1813337&view=diff
==============================================================================
--- jackrabbit/branches/2.14/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java
(original)
+++ jackrabbit/branches/2.14/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java
Wed Oct 25 18:38:16 2017
@@ -243,7 +243,9 @@ public class ConsistencyCheckerImpl {
                     allInfos.putAll(batch);
                 }
 
-                if (pm.exists(lastId)) {
+                if (lastId == null) {
+                    log.info("No nodes exists, skipping");
+                } else if (pm.exists(lastId)) {
                     for (Map.Entry<NodeId, NodeInfo> entry : allInfos.entrySet()) {
                         checkBundleConsistency(entry.getKey(), entry.getValue(), allInfos);
                     }

Modified: jackrabbit/branches/2.14/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.14/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java?rev=1813337&r1=1813336&r2=1813337&view=diff
==============================================================================
--- jackrabbit/branches/2.14/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java
(original)
+++ jackrabbit/branches/2.14/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java
Wed Oct 25 18:38:16 2017
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.core.data;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -221,6 +222,13 @@ public class ConsistencyCheckerImplTest
         assertTrue("Expected orphan to be modified", listener.changes.isModified(orphanedId));
     }
 
+    public void testEmptyRepo() throws RepositoryException {
+        List<NodePropBundle> t = Collections.emptyList();
+        MockPersistenceManager pm = new MockPersistenceManager(t);
+        ConsistencyCheckerImpl checker = new ConsistencyCheckerImpl(pm, null, null, null);
+        checker.check(null, false);
+    }
+
     public void testDoubleCheckOrphanedNode() throws RepositoryException {
         NodePropBundle orphaned = new NodePropBundle(new NodeId(0, 1));
         orphaned.setParentId(new NodeId(1, 0));
@@ -453,6 +461,11 @@ public class ConsistencyCheckerImplTest
         }
 
         @Override
+        public boolean exists(final NodeId id) {
+            return bundles.containsKey(id);
+        }
+
+        @Override
         protected void evictBundle(final NodeId id) {
         }
 



Mime
View raw message