jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1179548 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version: InconsistentVersioningState.java InternalVersionHistoryImpl.java InternalVersionImpl.java
Date Thu, 06 Oct 2011 09:26:14 GMT
Author: reschke
Date: Thu Oct  6 09:26:13 2011
New Revision: 1179548

URL: http://svn.apache.org/viewvc?rev=1179548&view=rev
Log:
JCR-3017: Version history recovery fails in case a version does not have a jcr:frozenNode

Added:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InconsistentVersioningState.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InconsistentVersioningState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InconsistentVersioningState.java?rev=1179548&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InconsistentVersioningState.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InconsistentVersioningState.java
Thu Oct  6 09:26:13 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.version;
+
+/**
+ * The <code>InconsistentVersionControlState</code> is used to signal
+ * inconsistencies in the versioning related state of a node, such
+ * as missing mandatory properties, missing version nodes, etc.
+ */
+public class InconsistentVersioningState extends RuntimeException {
+
+    /**
+     * Constructs a new instance of this class with the specified detail
+     * message.
+     *
+     * @param message the detail message. The detail message is saved for
+     *                later retrieval by the {@link #getMessage()} method.
+     */
+    public InconsistentVersioningState(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a new instance of this class with the specified detail
+     * message and root cause.
+     *
+     * @param message   the detail message. The detail message is saved for
+     *                  later retrieval by the {@link #getMessage()} method.
+     * @param rootCause root failure cause
+     */
+    public InconsistentVersioningState(String message, Throwable rootCause) {
+        super(message, rootCause);
+    }
+
+}

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java?rev=1179548&r1=1179547&r2=1179548&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
Thu Oct  6 09:26:13 2011
@@ -238,7 +238,7 @@ class InternalVersionHistoryImpl extends
                     v = new InternalVersionImpl(this, child, child.getName());
                 }
             } catch (RepositoryException e) {
-                throw new InternalError("Version does not have a jcr:frozenNode: " + child.getNodeId());
+                throw new InconsistentVersioningState("Version does not have a jcr:frozenNode:
" + child.getNodeId(), e);
             }
         }
         return v;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java?rev=1179548&r1=1179547&r2=1179548&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java
Thu Oct  6 09:26:13 2011
@@ -121,7 +121,7 @@ class InternalVersionImpl extends Intern
         try {
             return (InternalFrozenNode) vMgr.getItem(getFrozenNodeId());
         } catch (RepositoryException e) {
-            throw new IllegalStateException("unable to retrieve frozen node: " + e);
+            throw new InconsistentVersioningState("unable to retrieve frozen node: " + e,
e);
         }
     }
 
@@ -131,7 +131,7 @@ class InternalVersionImpl extends Intern
     public NodeId getFrozenNodeId() {
         ChildNodeEntry entry = node.getState().getChildNodeEntry(NameConstants.JCR_FROZENNODE,
1);
         if (entry == null) {
-            throw new InternalError("version has no frozen node: " + getId());
+            throw new InconsistentVersioningState("version has no frozen node: " + getId());
         }
         return entry.getId();
     }



Mime
View raw message