Permalink
Browse files

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

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/branches/JCR-2272@1176545 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent a0ba130 commit 12f8309c8e9cada4b9ed46e8e9642e9c54e3bbbc @jukka jukka committed Sep 27, 2011
@@ -464,7 +464,7 @@ public Name getName(NodeId id, NodeId parentId)
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();
}
@@ -554,9 +554,9 @@ public boolean isItemStateInAttic(ItemId id) {
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.
@@ -22,6 +22,7 @@
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 Object run() throws RepositoryException {
});
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(
@@ -21,6 +21,7 @@
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 void execute(Session session, Node test) throws RepositoryException {
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);

0 comments on commit 12f8309

Please sign in to comment.