jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1176545 - in /jackrabbit/branches/JCR-2272/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/ main/java/org/apache/jackrabbit/core/state/ main/java/org/apache/jackrabbit/core/version/ test/java/org/apache/jackrabbit/core/
Date Tue, 27 Sep 2011 19:27:07 GMT
Author: jukka
Date: Tue Sep 27 19:27:07 2011
New Revision: 1176545

URL: http://svn.apache.org/viewvc?rev=1176545&view=rev
Log:
JCR-2272: Errors during concurrent session import of nodes with same UUIDs

More accurate error reporting from cases where a concurrent process invalidates an item

Modified:
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerImpl.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentImportTest.java

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java?rev=1176545&r1=1176544&r2=1176545&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
(original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
Tue Sep 27 19:27:07 2011
@@ -464,7 +464,7 @@ public class HierarchyManagerImpl implem
         if (entry == null) {
             String msg = "failed to resolve name of " + id;
             log.debug(msg);
-            throw new RepositoryException(msg);
+            throw new ItemNotFoundException(msg);
         }
         return entry.getName();
     }

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java?rev=1176545&r1=1176544&r2=1176545&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
(original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
Tue Sep 27 19:27:07 2011
@@ -554,9 +554,9 @@ public class SessionItemStateManager
     public NodeState createTransientNodeState(NodeId id, Name nodeTypeName, NodeId parentId,
int initialStatus)
             throws RepositoryException {
         if (initialStatus == ItemState.STATUS_NEW && id != null
-                    && hasItemState(id)) {
-                throw new InvalidItemStateException(
-                        "Node " + id + " already exists");
+                && hasItemState(id)) {
+            throw new InvalidItemStateException(
+                    "Node " + id + " already exists");
         }
 
         // check map; synchronized to ensure an entry is not created twice.

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerImpl.java?rev=1176545&r1=1176544&r2=1176545&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerImpl.java
(original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerImpl.java
Tue Sep 27 19:27:07 2011
@@ -22,6 +22,7 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
+import javax.jcr.InvalidItemStateException;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -258,7 +259,8 @@ public class InternalVersionManagerImpl 
         });
 
         if (state == null) {
-            throw new VersionException("History already exists for node " + node.getNodeId());
+            throw new InvalidItemStateException(
+                    "History already exists for node " + node.getNodeId());
         }
         Name root = NameConstants.JCR_ROOTVERSION;
         return new VersionHistoryInfo(

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentImportTest.java?rev=1176545&r1=1176544&r2=1176545&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentImportTest.java
(original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentImportTest.java
Tue Sep 27 19:27:07 2011
@@ -21,6 +21,7 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
 import javax.jcr.ImportUUIDBehavior;
+import javax.jcr.InvalidItemStateException;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -94,9 +95,7 @@ public class ConcurrentImportTest extend
                                 log.println("Added " + test.getPath() + "/"
                                         + uuid);
                                 log.flush();
-                            } catch (RepositoryException e) {
-                                // we allow all kinds of REs here; this is temporary
-                                // in theory, we shouldn't get exceptions at all; see JCR-3068
+                            } catch (InvalidItemStateException e) {
                                 log.println("Ignoring expected error: " + e.toString());
                                 log.flush();
                                 session.refresh(false);



Mime
View raw message