jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1304466 - in /jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query: OnWorkspaceInconsistency.java lucene/MultiIndex.java
Date Fri, 23 Mar 2012 16:32:14 GMT
Author: alexparvulescu
Date: Fri Mar 23 16:32:14 2012
New Revision: 1304466

URL: http://svn.apache.org/viewvc?rev=1304466&view=rev
Log:
JCR-3268 Re-index fails on corrupt bundle (2.4 port)

Modified:
    jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
    jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java

Modified: jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java?rev=1304466&r1=1304465&r2=1304466&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
Fri Mar 23 16:32:14 2012
@@ -161,4 +161,36 @@ public abstract class OnWorkspaceInconsi
                                                 NodeState node,
                                                 ChildNodeEntry child)
             throws ItemStateException, RepositoryException;
+
+    /**
+     * Logs a generic workspace inconsistency error.
+     *
+     * @param exception the exception that was thrown when working on the workspace
+     * @param handler   the query handler.
+     * @param path      the path of the parent node.
+     * @param node      the parent node state.
+     * @param child     the child node entry, for which no node state could be
+     *                  found.
+     * @throws RepositoryException if another error occurs not related to item
+     *                             state reading.
+     */
+    public void logError(ItemStateException exception, QueryHandler handler,
+            Path path, NodeState node, ChildNodeEntry child)
+            throws RepositoryException {
+        if (log.isErrorEnabled()) {
+            NamePathResolver resolver = new DefaultNamePathResolver(handler
+                    .getContext().getNamespaceRegistry());
+            StringBuilder err = new StringBuilder();
+            err.append("Workspace inconsistency error on node ");
+            err.append(resolver.getJCRPath(path));
+            err.append(" (");
+            err.append(node.getNodeId());
+            err.append(") with child ");
+            err.append(resolver.getJCRName(child.getName()));
+            err.append(" (");
+            err.append(child.getId());
+            err.append(").");
+            log.error(err.toString(), exception);
+        }
+    }
 }

Modified: jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java?rev=1304466&r1=1304465&r2=1304466&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
Fri Mar 23 16:32:14 2012
@@ -1237,6 +1237,10 @@ public class MultiIndex {
             } catch (NoSuchItemStateException e) {
                 handler.getOnWorkspaceInconsistencyHandler().handleMissingChildNode(
                         e, handler, path, node, child);
+            } catch (ItemStateException e) {
+                // JCR-3268 log bundle corruption and continue
+                handler.getOnWorkspaceInconsistencyHandler().logError(e,
+                        handler, childPath, node, child);
             }
             if (childState != null) {
                 count = createIndex(childState, childPath, stateMgr, count);



Mime
View raw message