jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r518923 - /jackrabbit/trunk/contrib/spi/spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java
Date Fri, 16 Mar 2007 10:26:58 GMT
Author: angela
Date: Fri Mar 16 03:26:57 2007
New Revision: 518923

URL: http://svn.apache.org/viewvc?view=rev&rev=518923
Log:
renive: if remove-target cannot be retrieved InvalidItemStateException is appropriate rather
than PathNotFoundException, because it indicates that the item was available in jcr2spi but
got removed in the mean time.

Modified:
    jackrabbit/trunk/contrib/spi/spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java

Modified: jackrabbit/trunk/contrib/spi/spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java?view=diff&rev=518923&r1=518922&r2=518923
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java
Fri Mar 16 03:26:57 2007
@@ -1022,10 +1022,20 @@
         public void remove(final ItemId itemId) throws RepositoryException {
             executeGuarded(new Callable() {
                 public Object run() throws RepositoryException {
-                    if (itemId.denotesNode()) {
-                        getNode((NodeId) itemId, sInfo).remove();
-                    } else {
-                        getProperty((PropertyId) itemId, sInfo).remove();
+                    try {
+                        if (itemId.denotesNode()) {
+                            getNode((NodeId) itemId, sInfo).remove();
+                        } else {
+                            getProperty((PropertyId) itemId, sInfo).remove();
+                        }
+                    } catch (ItemNotFoundException e) {
+                        // item was present in jcr2spi but got removed on the
+                        // persistent layer in the mean time.
+                        throw new InvalidItemStateException(e);
+                    } catch (PathNotFoundException e) {
+                        // item was present in jcr2spi but got removed on the
+                        // persistent layer in the mean time.
+                        throw new InvalidItemStateException(e);
                     }
                     return null;
                 }
@@ -1242,7 +1252,7 @@
         }
     }
 
-    private Node getNode(NodeId id, SessionInfoImpl sessionInfo) throws PathNotFoundException,
RepositoryException {
+    private Node getNode(NodeId id, SessionInfoImpl sessionInfo) throws ItemNotFoundException,
PathNotFoundException, RepositoryException {
         Session session = sessionInfo.getSession();
         Node n;
         if (id.getUniqueID() != null) {
@@ -1266,7 +1276,7 @@
         return n.getNode(jcrPath);
     }
 
-    private Property getProperty(PropertyId id, SessionInfoImpl sessionInfo) throws ItemNotFoundException,
RepositoryException {
+    private Property getProperty(PropertyId id, SessionInfoImpl sessionInfo) throws ItemNotFoundException,
PathNotFoundException, RepositoryException {
         Session session = sessionInfo.getSession();
         Node n;
         if (id.getUniqueID() != null) {



Mime
View raw message