You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2011/12/19 18:00:24 UTC

svn commit: r1220845 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java

Author: reschke
Date: Mon Dec 19 17:00:24 2011
New Revision: 1220845

URL: http://svn.apache.org/viewvc?rev=1220845&view=rev
Log:
JCR-3185: refactor consistency checks in BundleDBPersistenceManager into a standalone class that could be re-used for other PMs

in consistency check, only use BundlePm APIs (work-in-progress)

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java?rev=1220845&r1=1220844&r2=1220845&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java Mon Dec 19 17:00:24 2011
@@ -855,25 +855,24 @@ public class BundleDbPersistenceManager
                 Iterable<NodeId> allIds = getAllNodeIds(null, 0);
 
                 for (NodeId id : allIds) {
-                    ResultSet rs = null;
                     try {
-                        rs = conHelper.exec(bundleSelectSQL, getKey(id), false, 0);
-                        if (!rs.next()) {
-                            throw new SQLException("bundle cannot be retrieved?");
-                        }
                         // parse and check bundle
-                        NodePropBundle bundle = readBundle(id, rs, 1);
-                        checkBundleConsistency(id, bundle, fix, modifications, reports);
-                    } catch (SQLException e) {
-                        log.error("Unable to parse bundle " + id, e);
-                    } finally {
-                        DbUtility.close(rs);
+                        NodePropBundle bundle = loadBundle(id);
+                        if (bundle == null) {
+                            log.error("No bundle found for id '" + id + "'");
+                        } else {
+                            checkBundleConsistency(id, bundle, fix, modifications, reports);
+
+                            count++;
+                            if (count % 1000 == 0) {
+                                log.info(name + ": checked " + count + "/" + total + " bundles...");
+                            }
+                        }
+                    } catch (ItemStateException e) {
+                        // problem already logged (loadBundle called with
+                        // logDetailedErrors=true)
                     }
 
-                    count++;
-                    if (count % 1000 == 0) {
-                        log.info(name + ": checked " + count + "/" + total + " bundles...");
-                    }
                 }
             } catch (ItemStateException ex) {
                 throw new RepositoryException("getting nodeIds", ex);
@@ -908,20 +907,20 @@ public class BundleDbPersistenceManager
 
                     if (bundle == null) {
                         log.error("No bundle found for id '" + id + "'");
-                        continue;
                     }
+                    else {
+                        checkBundleConsistency(id, bundle, fix, modifications, reports);
 
-                    checkBundleConsistency(id, bundle, fix, modifications, reports);
-
-                    if (recursive) {
-                        for (NodePropBundle.ChildNodeEntry entry : bundle.getChildNodeEntries()) {
-                            idList.add(entry.getId());
+                        if (recursive) {
+                            for (NodePropBundle.ChildNodeEntry entry : bundle.getChildNodeEntries()) {
+                                idList.add(entry.getId());
+                            }
                         }
-                    }
 
-                    count++;
-                    if (count % 1000 == 0) {
-                        log.info(name + ": checked " + count + "/" + idList.size() + " bundles...");
+                        count++;
+                        if (count % 1000 == 0) {
+                            log.info(name + ": checked " + count + "/" + idList.size() + " bundles...");
+                        }
                     }
                 } catch (ItemStateException e) {
                     // problem already logged (loadBundle called with logDetailedErrors=true)