jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r520315 [1/2] - in /jackrabbit/trunk/contrib/spi/jcr2spi: ./ src/main/java/org/apache/jackrabbit/jcr2spi/ src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ src/main/java/org/apache/jackrabbit/jcr2spi/lock/ src/main/java/org/apache/jack...
Date Tue, 20 Mar 2007 08:22:25 GMT
Author: angela
Date: Tue Mar 20 01:22:22 2007
New Revision: 520315

URL: http://svn.apache.org/viewvc?view=rev&rev=520315
Log:
remove ItemStateException (and subclasses) and replace their usage with RepositoryException and subclasses respectively

Removed:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateException.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NoSuchItemStateException.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/StaleItemStateException.java
Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/TODO.txt
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/LazyItemIterator.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryValidation.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntry.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Remove.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ReorderNodes.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/TODO.txt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/TODO.txt?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/TODO.txt (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/TODO.txt Tue Mar 20 01:22:22 2007
@@ -17,10 +17,6 @@
 
 - IMPROVE: Replace ItemState-duality by copy on write behaviour
 
-- IMPROVE: review if ItemStateExceptions are really needed. currently
-           they are created from RepositoryExceptions and rethrown as
-           RepositoryExceptions
-           
 - IMPROVE: consistency of PathNotFoundException and ItemNotFoundException.
 
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java Tue Mar 20 01:22:22 2007
@@ -18,8 +18,6 @@
 
 import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.StaleItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateValidator;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateLifeCycleListener;
 import org.apache.jackrabbit.jcr2spi.state.Status;
@@ -241,15 +239,7 @@
     public void save() throws AccessDeniedException, ConstraintViolationException, InvalidItemStateException, ReferentialIntegrityException, VersionException, LockException, RepositoryException {
         // check state of this instance
         checkStatus();
-        try {
-            session.getSessionItemStateManager().save(getItemState());
-        } catch (StaleItemStateException e) {
-            throw new InvalidItemStateException(e);
-        } catch (ItemStateException e) {
-            String msg = "Unable to update item (" + safeGetJCRPath() + ")";
-            log.debug(msg);
-            throw new RepositoryException(msg, e);
-        }
+        session.getSessionItemStateManager().save(getItemState());
     }
 
     /**
@@ -285,13 +275,8 @@
             /*
             Reset all transient modifications from this item and its decendants.
             */
-            try {
-                session.getSessionItemStateManager().undo(state);
-            } catch (ItemStateException e) {
-                String msg = "Unable to undo item (" + safeGetJCRPath() + ")";
-                log.debug(msg);
-                throw new RepositoryException(msg, e);
-            }
+            session.getSessionItemStateManager().undo(state);
+
             /* Unless the session is in 'observation' mode, mark all states
                within this tree 'invalidated' in order to have them refreshed
                from the server upon the next access.*/

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java Tue Mar 20 01:22:22 2007
@@ -23,8 +23,6 @@
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 import org.apache.jackrabbit.jcr2spi.util.Dumpable;
 import org.apache.jackrabbit.jcr2spi.util.LogUtil;
 import org.apache.jackrabbit.jcr2spi.version.VersionHistoryImpl;
@@ -112,9 +110,9 @@
             // session-sanity & permissions are checked upon itemExists(ItemState)
             ItemState state = hierarchyEntry.getItemState();
             return itemExists(state);
-        } catch (NoSuchItemStateException e) {
+        } catch (ItemNotFoundException e) {
             return false;
-        } catch (ItemStateException e) {
+        } catch (RepositoryException e) {
             return false;
         }
     }
@@ -156,14 +154,8 @@
      * @see ItemManager#getItem(HierarchyEntry)
      */
     public Item getItem(HierarchyEntry hierarchyEntry) throws ItemNotFoundException, AccessDeniedException, RepositoryException {
-        try {
-            ItemState itemState = hierarchyEntry.getItemState();
-            return getItem(itemState);
-        } catch (NoSuchItemStateException e) {
-            throw new ItemNotFoundException(e);
-        } catch (ItemStateException e) {
-            throw new RepositoryException(e);
-        }
+        ItemState itemState = hierarchyEntry.getItemState();
+        return getItem(itemState);
     }
 
     /**
@@ -210,7 +202,7 @@
                 NodeEntry entry = (NodeEntry) iter.next();
                 entry.getNodeState();
                 return true;
-            } catch (ItemStateException e) {
+            } catch (ItemNotFoundException e) {
                 // should not occur. ignore
                 log.debug("Failed to access node state.", e);
             }
@@ -245,7 +237,7 @@
                 // check read access by accessing the propState (also implicit validation).
                 entry.getPropertyState();
                 return true;
-            } catch (ItemStateException e) {
+            } catch (ItemNotFoundException e) {
                 // should not occur. ignore
                 log.debug("Failed to access node state.", e);
             }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/LazyItemIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/LazyItemIterator.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/LazyItemIterator.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/LazyItemIterator.java Tue Mar 20 01:22:22 2007
@@ -30,7 +30,6 @@
 import javax.jcr.Node;
 import javax.jcr.Property;
 import javax.jcr.RangeIterator;
-import javax.jcr.PathNotFoundException;
 import javax.jcr.version.VersionIterator;
 import javax.jcr.version.Version;
 import java.util.NoSuchElementException;
@@ -90,7 +89,7 @@
      */
     public LazyItemIterator(ItemManager itemMgr, HierarchyManager hierarchyMgr,
                             Iterator itemIds)
-        throws PathNotFoundException, RepositoryException {
+        throws ItemNotFoundException, RepositoryException {
         this.itemMgr = itemMgr;
         List entries = new ArrayList();
         while (itemIds.hasNext()) {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java Tue Mar 20 01:22:22 2007
@@ -28,9 +28,7 @@
 import org.apache.jackrabbit.name.PathFormat;
 import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateValidator;
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.NodeReferences;
 import org.apache.jackrabbit.jcr2spi.state.Status;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
@@ -230,14 +228,7 @@
         Path.PathElement srcName = getReorderPath(srcChildRelPath).getNameElement();
         Path.PathElement beforeName = (destChildRelPath == null) ? null : getReorderPath(destChildRelPath).getNameElement();
 
-        Operation op;
-        try {
-            op = ReorderNodes.create(getNodeState(), srcName, beforeName);
-        } catch (NoSuchItemStateException e) {
-            throw new ItemNotFoundException(e.getMessage(), e);
-        } catch (ItemStateException e) {
-            throw new RepositoryException("Unable to reorder nodes: " + e.getMessage(), e);
-        }
+        Operation op = ReorderNodes.create(getNodeState(), srcName, beforeName);
         session.getSessionItemStateManager().execute(op);
     }
 
@@ -737,7 +728,7 @@
                 try {
                     PropertyState ps = getNodeState().getPropertyState(QName.JCR_MIXINTYPES);
                     mixinValue = StateUtility.getMixinNames(ps);
-                } catch (ItemStateException e) {
+                } catch (RepositoryException e) {
                     // should never occur
                     log.error("Internal error", e);
                 }
@@ -1359,8 +1350,6 @@
             return (Property) itemMgr.getItem(pEntry);
         } catch (AccessDeniedException e) {
             throw new PathNotFoundException(qName.toString());
-        } catch (ItemNotFoundException e) {
-            throw new PathNotFoundException(qName.toString());
         }
     }
 
@@ -1445,7 +1434,7 @@
      */
     private Property createProperty(QName qName, int type, QPropertyDefinition def,
                                     QValue[] qvs)
-        throws PathNotFoundException, ConstraintViolationException, RepositoryException {
+        throws ConstraintViolationException, RepositoryException {
         Operation op = AddProperty.create(getNodeState(), qName, type, def, qvs);
         session.getSessionItemStateManager().execute(op);
         return getProperty(qName);

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java Tue Mar 20 01:22:22 2007
@@ -257,8 +257,6 @@
                 log.error("NodeId '" + id + " does not point to a Node");
                 throw new ItemNotFoundException(id.toString());
             }
-        } catch (PathNotFoundException e) {
-            throw new ItemNotFoundException(id.toString());
         } catch (AccessDeniedException e) {
             throw new ItemNotFoundException(id.toString());
         }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java Tue Mar 20 01:22:22 2007
@@ -20,11 +20,12 @@
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.spi.ChildInfo;
 import org.apache.commons.collections.list.AbstractLinkedList;
 import org.apache.commons.collections.iterators.UnmodifiableIterator;
 
+import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
 import java.util.Collection;
 import java.util.Map;
 import java.util.HashMap;
@@ -316,8 +317,9 @@
                         } else {
                             // child node removed
                         }
-                    } catch (ItemStateException e) {
-                        // should never happen, cne.isAvailable() returned true
+                    } catch (RepositoryException e) {
+                        // ignore for index detection. entry does not exist or is
+                        // not accessible
                     }
                 } else {
                     // then this child node entry has never been accessed
@@ -570,7 +572,7 @@
 
     /**
      * Returns the matching <code>LinkNode</code> from a list or a single
-     * <code>LinkNode</code>. This method will throw <code>NoSuchItemStateException</code>
+     * <code>LinkNode</code>. This method will return <code>null</code>
      * if none of the entries matches either due to missing entry for given
      * state name or due to missing availability of the <code>NodeEntry</code>.
      *

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryValidation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryValidation.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryValidation.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryValidation.java Tue Mar 20 01:22:22 2007
@@ -18,9 +18,9 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 
+import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
 import java.util.Iterator;
 
 /**
@@ -65,10 +65,10 @@
         if (cne.isAvailable()) {
             try {
                 isValid = cne.getNodeState().isValid();
-            } catch (NoSuchItemStateException e) {
+            } catch (ItemNotFoundException e) {
                 // may occur if the cached state is marked 'INVALIDATED' and
                 // does not exist any more on the persistent layer -> invalid.
-            } catch (ItemStateException e) {
+            } catch (RepositoryException e) {
                 // should not occur, if the cne is available.
             }
         } else {
@@ -97,10 +97,10 @@
         if (cpe.isAvailable()) {
             try {
                 isValid = cpe.getPropertyState().isValid();
-            } catch (NoSuchItemStateException e) {
+            } catch (ItemNotFoundException e) {
                 // may occur if the cached state is marked 'INVALIDATED' and
                 // does not exist any more on the persistent layer -> invalid.
-            } catch (ItemStateException e) {
+            } catch (RepositoryException e) {
                 // probably deleted in the meantime. should not occur.
             }
         } else {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java Tue Mar 20 01:22:22 2007
@@ -18,14 +18,13 @@
 
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.ChangeLog;
-import org.apache.jackrabbit.jcr2spi.state.StaleItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.Status;
 
 import javax.jcr.RepositoryException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemNotFoundException;
 
 /**
  * <code>HierarchyEntry</code>...
@@ -101,7 +100,7 @@
      * @throws ItemStateException If an error occurs while retrieving the
      * <code>ItemState</code>.
      */
-    public ItemState getItemState() throws NoSuchItemStateException, ItemStateException;
+    public ItemState getItemState() throws ItemNotFoundException, RepositoryException;
 
     /**
      * Invalidates the underlying <code>ItemState</code> if available. If the
@@ -119,8 +118,9 @@
      * adding, modifying or removing item states. 'Existing' item states
      * are reverted to their initial state and their status is reset to {@link Status#EXISTING}.
      *
+     * @throws RepositoryException if an error occurs.
      */
-    public void revert() throws ItemStateException;
+    public void revert() throws RepositoryException;
 
     /**
      * Reloads this hierarchy entry and the corresponding ItemState, if this
@@ -141,10 +141,10 @@
      * if the item has been transiently added before. In the latter case, the
      * corresponding HierarchyEntries can be removed as well from their parent.
      *
-     * @throws ItemStateException if an error occurs while removing any of the item
-     * state. e.g. an item state is not valid anymore.
+     * @throws RepositoryException if an error occurs while removing any of the item
+     * states e.g. an item state is not valid anymore.
      */
-    public void transientRemove() throws ItemStateException;
+    public void transientRemove() throws RepositoryException;
 
     /**
      * Removes this <code>HierarchyEntry</code> from its parent and sets the
@@ -164,9 +164,9 @@
      * @param changeLog the <code>ChangeLog</code> collecting the transient
      * item states present in a given tree.
      * @param throwOnStale If the given flag is true, this methods throws
-     * StaleItemStateException if this state is stale.
-     * @throws StaleItemStateException if <code>throwOnStale</code> is true and
+     * InvalidItemStateException if this state is stale.
+     * @throws InvalidItemStateException if <code>throwOnStale</code> is true and
      * this state is stale.
      */
-    public void collectStates(ChangeLog changeLog, boolean throwOnStale) throws StaleItemStateException;
+    public void collectStates(ChangeLog changeLog, boolean throwOnStale) throws InvalidItemStateException;
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java Tue Mar 20 01:22:22 2007
@@ -19,15 +19,14 @@
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.ChangeLog;
-import org.apache.jackrabbit.jcr2spi.state.StaleItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.Status;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.RepositoryException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemNotFoundException;
 import java.lang.ref.WeakReference;
 
 /**
@@ -84,11 +83,11 @@
      * a call to {@link ItemState#isValid()} does not equivocally return false.
      *
      * @return the <code>ItemState</code> where this reference points to.
-     * @throws NoSuchItemStateException if the referenced <code>ItemState</code>
-     *                                  does not exist.
-     * @throws ItemStateException       if an error occurs.
+     * @throws ItemNotFoundException if the referenced <code>ItemState</code>
+     * does not exist.
+     * @throws RepositoryException if an error occurs.
      */
-    ItemState resolve() throws NoSuchItemStateException, ItemStateException {
+    ItemState resolve() throws ItemNotFoundException, RepositoryException {
         // check if already resolved
         ItemState state = internalGetItemState();
         // not yet resolved. retrieve and keep weak reference to state
@@ -96,9 +95,11 @@
             try {
                 state = doResolve();
                 target = new WeakReference(state);
-            } catch (NoSuchItemStateException e) {
+            } catch (ItemNotFoundException e) {
                 remove();
                 throw e;
+            } catch (RepositoryException e) {
+                e.printStackTrace();
             }
         } else if (state.getStatus() == Status.INVALIDATED) {
             // completely reload this entry, but don't reload recursively
@@ -112,11 +113,11 @@
      * <code>ItemState</code> of this reference.
      *
      * @return the <code>ItemState</code> where this reference points to.
-     * @throws NoSuchItemStateException if the referenced <code>ItemState</code>
-     *                                  does not exist.
-     * @throws ItemStateException       if an error occurs.
+     * @throws ItemNotFoundException if the referenced <code>ItemState</code>
+     * does not exist.
+     * @throws RepositoryException if another error occurs.
      */
-    abstract ItemState doResolve() throws NoSuchItemStateException, ItemStateException;
+    abstract ItemState doResolve() throws ItemNotFoundException, RepositoryException;
 
     /**
      * Build the Path of this entry
@@ -222,7 +223,7 @@
      * {@inheritDoc}<br>
      * @see HierarchyEntry#getItemState()
      */
-    public ItemState getItemState() throws NoSuchItemStateException, ItemStateException {
+    public ItemState getItemState() throws ItemNotFoundException, RepositoryException {
         ItemState state = resolve();
         return state;
     }
@@ -245,7 +246,7 @@
      * {@inheritDoc}
      * @see HierarchyEntry#revert()
      */
-    public void revert() throws ItemStateException {
+    public void revert() throws RepositoryException {
         ItemState state = internalGetItemState();
         if (state == null) {
             // nothing to do
@@ -304,11 +305,11 @@
             // reload the workspace state from the persistent layer
             try {
                 state.reconnect(keepChanges);
-            } catch (NoSuchItemStateException e) {
+            } catch (ItemNotFoundException e) {
                 // remove hierarchyEntry (including all children and set
                 // state-status to REMOVED (or STALE_DESTROYED)
                 remove();
-            } catch (ItemStateException e) {
+            } catch (RepositoryException e) {
                 // TODO: rather throw? remove from parent?
                 log.warn("Exception while reloading property state: " + e);
                 log.debug("Stacktrace: ", e);
@@ -320,7 +321,7 @@
      * {@inheritDoc}
      * @see HierarchyEntry#transientRemove()
      */
-    public void transientRemove() throws ItemStateException {
+    public void transientRemove() throws RepositoryException {
         ItemState state = internalGetItemState();
         if (state == null) {
             // nothing to do -> correct status must be set upon resolution.
@@ -350,7 +351,7 @@
                 // if a conflict with a new entry occurs.
                 break;
             default:
-                throw new ItemStateException("Cannot transiently remove an ItemState with status " + Status.getName(state.getStatus()));
+                throw new RepositoryException("Cannot transiently remove an ItemState with status " + Status.getName(state.getStatus()));
         }
     }
 
@@ -358,7 +359,7 @@
      * {@inheritDoc}
      * @see HierarchyEntry#collectStates(ChangeLog, boolean)
      */
-    public void collectStates(ChangeLog changeLog, boolean throwOnStale) throws StaleItemStateException {
+    public void collectStates(ChangeLog changeLog, boolean throwOnStale) throws InvalidItemStateException {
         ItemState state = internalGetItemState();
         if (state == null) {
             // nothing to do
@@ -368,7 +369,7 @@
         if (throwOnStale && Status.isStale(state.getStatus())) {
             String msg = "Cannot save changes: " + state + " has been modified externally.";
             log.debug(msg);
-            throw new StaleItemStateException(msg);
+            throw new InvalidItemStateException(msg);
         }
         // only interested in transient modifications or stale-modified states
         switch (state.getStatus()) {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java Tue Mar 20 01:22:22 2007
@@ -62,7 +62,7 @@
      * @throws PathNotFoundException
      * @throws RepositoryException
      */
-    public HierarchyEntry getHierarchyEntry(ItemId itemId) throws PathNotFoundException, RepositoryException;
+    public HierarchyEntry getHierarchyEntry(ItemId itemId) throws ItemNotFoundException, RepositoryException;
 
     /**
      * Resolves a path into a <code>HierarchyEntry</code>.

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java Tue Mar 20 01:22:22 2007
@@ -17,8 +17,6 @@
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.TransientItemStateFactory;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.spi.ItemId;
@@ -85,7 +83,7 @@
     /**
      * @see HierarchyManager#getHierarchyEntry(ItemId)
      */
-    public HierarchyEntry getHierarchyEntry(ItemId itemId) throws PathNotFoundException, RepositoryException {
+    public HierarchyEntry getHierarchyEntry(ItemId itemId) throws ItemNotFoundException, RepositoryException {
         String uniqueID = itemId.getUniqueID();
         if (uniqueID == null) {
             return getHierarchyEntry(itemId.getPath());
@@ -131,10 +129,8 @@
             } else {
                 throw new PathNotFoundException();
             }
-        } catch (NoSuchItemStateException e) {
+        } catch (ItemNotFoundException e) {
             throw new PathNotFoundException(e);
-        } catch (ItemStateException e) {
-            throw new RepositoryException(e);
         }
     }
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java Tue Mar 20 01:22:22 2007
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.name.QName;
@@ -30,6 +28,7 @@
 import javax.jcr.ItemExistsException;
 import javax.jcr.RepositoryException;
 import javax.jcr.PathNotFoundException;
+import javax.jcr.ItemNotFoundException;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Collection;
@@ -77,12 +76,12 @@
 
     /**
      * @return the referenced <code>NodeState</code>.
-     * @throws NoSuchItemStateException if the <code>NodeState</code> does not
-     * exist anymore.
-     * @throws ItemStateException If an error occurs while retrieving the
+     * @throws ItemNotFoundException if the <code>NodeState</code> does not
+     * exist.
+     * @throws RepositoryException If an error occurs while retrieving the
      * <code>NodeState</code>.
      */
-    public NodeState getNodeState() throws NoSuchItemStateException, ItemStateException;
+    public NodeState getNodeState() throws ItemNotFoundException, RepositoryException;
 
     /**
      * Traverse the tree below this entry and return the child entry matching

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java Tue Mar 20 01:22:22 2007
@@ -28,11 +28,8 @@
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.ChangeLog;
-import org.apache.jackrabbit.jcr2spi.state.StaleItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.Status;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateLifeCycleListener;
@@ -45,6 +42,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.PathNotFoundException;
 import javax.jcr.ItemNotFoundException;
+import javax.jcr.InvalidItemStateException;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
@@ -193,7 +191,7 @@
      * @inheritDoc
      * @see HierarchyEntry#revert()
      */
-    public void revert() throws ItemStateException {
+    public void revert() throws RepositoryException {
         // move all properties from attic back to properties map
         if (!propertiesInAttic.isEmpty()) {
             properties.putAll(propertiesInAttic);
@@ -209,7 +207,7 @@
     /**
      * @see HierarchyEntry#transientRemove()
      */
-    public void transientRemove() throws ItemStateException {
+    public void transientRemove() throws RepositoryException {
         for (Iterator it = getAllChildEntries(true, false); it.hasNext();) {
             HierarchyEntry ce = (HierarchyEntry) it.next();
             ce.transientRemove();
@@ -270,7 +268,7 @@
      * @inheritDoc
      * @see HierarchyEntry#collectStates(ChangeLog, boolean)
      */
-    public void collectStates(ChangeLog changeLog, boolean throwOnStale) throws StaleItemStateException {
+    public void collectStates(ChangeLog changeLog, boolean throwOnStale) throws InvalidItemStateException {
         super.collectStates(changeLog, throwOnStale);
 
         // collect transient child states including properties in attic.
@@ -361,8 +359,7 @@
      * @inheritDoc
      * @see NodeEntry#getNodeState()
      */
-    public NodeState getNodeState()
-            throws NoSuchItemStateException, ItemStateException {
+    public NodeState getNodeState() throws ItemNotFoundException, RepositoryException {
         return (NodeState) getItemState();
     }
 
@@ -411,7 +408,7 @@
                 * Unknown entry (not-existing or not yet loaded):
                 * Skip all intermediate entries and directly try to load the ItemState
                 * (including building the itermediate entries. If that fails
-                * NoSuchItemStateException is thrown.
+                * ItemNotFoundException is thrown.
                 *
                 * Since 'path' might be ambigous (Node or Property):
                 * 1) first try Node
@@ -436,7 +433,7 @@
                 try {
                     NodeState state = entry.factory.getItemStateFactory().createDeepNodeState(nodeId, entry);
                     return state.getHierarchyEntry();
-                } catch (NoSuchItemStateException e) {
+                } catch (ItemNotFoundException e) {
                     if (index != Path.INDEX_DEFAULT) {
                         throw new PathNotFoundException(path.toString(), e);
                     }
@@ -446,13 +443,9 @@
                         PropertyId id = idFactory.createPropertyId(nodeId, remainingPath.getNameElement().getName());
                         PropertyState state = entry.factory.getItemStateFactory().createDeepPropertyState(id, entry);
                         return state.getHierarchyEntry();
-                    } catch (NoSuchItemStateException ise) {
+                    } catch (ItemNotFoundException ise) {
                         throw new PathNotFoundException(path.toString());
-                    } catch (ItemStateException ise) {
-                        throw new RepositoryException("Internal error", ise);
                     }
-                } catch (ItemStateException e) {
-                    throw new RepositoryException("Internal error", e);
                 }
             }
         }
@@ -749,10 +742,13 @@
                     // existing is still existing -> cannot add same-named property
                     throw new ItemExistsException(propName.toString());
                 }
-            } catch (ItemStateException e) {
-                // entry probably does not exist on the persistent layer
+            } catch (ItemNotFoundException e) {
+                // entry does not exist on the persistent layer
                 // -> therefore remove from properties map
                 properties.remove(propName);
+            } catch (RepositoryException e) {
+                // some other error -> remove from properties map
+                properties.remove(propName);
             }
         }
 
@@ -934,7 +930,7 @@
      * <p/>
      * Returns a <code>NodeState</code>.
      */
-    ItemState doResolve() throws NoSuchItemStateException, ItemStateException {
+    ItemState doResolve() throws ItemNotFoundException, RepositoryException {
         return factory.getItemStateFactory().createNodeState(getWorkspaceId(), this);
     }
 
@@ -1121,8 +1117,6 @@
                     state.setMixinTypeNames(StateUtility.getMixinNames(ps));
                 } // nodestate not yet loaded -> ignore change
             }
-        } catch (ItemStateException e) {
-            log.error("Internal Error", e);
         } catch (RepositoryException e) {
             log.error("Internal Error", e);
         }
@@ -1173,10 +1167,10 @@
                 ChildInfo ci = (ChildInfo) it.next();
                 internalAddNodeEntry(ci.getName(), ci.getUniqueID(), ci.getIndex(), childNodeEntries);
             }
-        } catch (NoSuchItemStateException e) {
+        } catch (ItemNotFoundException e) {
             log.error("Cannot retrieve child node entries.", e);
             // ignore (TODO correct?)
-        } catch (ItemStateException e) {
+        } catch (RepositoryException e) {
             log.error("Cannot retrieve child node entries.", e);
             // ignore (TODO correct?)
         }
@@ -1228,10 +1222,10 @@
             for (int i = 0; i < newEntries.size(); i++) {
                 cnEntries.add((NodeEntry) newEntries.get(i));
             }
-        } catch (NoSuchItemStateException e) {
+        } catch (ItemNotFoundException e) {
             log.error("Cannot retrieve child node entries.", e);
             // ignore (TODO correct?)
-        } catch (ItemStateException e) {
+        } catch (RepositoryException e) {
             log.error("Cannot retrieve child node entries.", e);
             // ignore (TODO correct?)
         }
@@ -1459,7 +1453,7 @@
                 // child has been moved away -> move back
                 try {
                     child.revert();
-                } catch (ItemStateException e) {
+                } catch (RepositoryException e) {
                     log.error("Internal error", e);
                     return false;
                 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntry.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntry.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntry.java Tue Mar 20 01:22:22 2007
@@ -16,11 +16,12 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.spi.PropertyId;
 
+import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
+
 /**
  * <code>PropertyEntry</code>...
  */
@@ -44,11 +45,11 @@
 
     /**
      * @return the referenced <code>PropertyState</code>.
-     * @throws NoSuchItemStateException if the <code>PropertyState</code> does not
+     * @throws ItemNotFoundException if the <code>PropertyState</code> does not
      * exist anymore.
-     * @throws ItemStateException if an error occurs while retrieving the
+     * @throws RepositoryException if an error occurs while retrieving the
      * <code>PropertyState</code>.
      */
-    public PropertyState getPropertyState() throws NoSuchItemStateException, ItemStateException;
+    public PropertyState getPropertyState() throws ItemNotFoundException, RepositoryException;
 
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java Tue Mar 20 01:22:22 2007
@@ -21,12 +21,11 @@
 import org.apache.jackrabbit.name.MalformedPathException;
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.Status;
 
 import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
 
 /**
  * <code>PropertyEntryImpl</code> implements a reference to a property state.
@@ -64,7 +63,7 @@
      * <p/>
      * Returns a <code>PropertyState</code>.
      */
-    ItemState doResolve() throws NoSuchItemStateException, ItemStateException {
+    ItemState doResolve() throws ItemNotFoundException, RepositoryException {
         return factory.getItemStateFactory().createPropertyState(getWorkspaceId(), this);
     }
 
@@ -103,7 +102,7 @@
     /**
      * @see PropertyEntry#getPropertyState()
      */
-    public PropertyState getPropertyState() throws NoSuchItemStateException, ItemStateException {
+    public PropertyState getPropertyState() throws ItemNotFoundException, RepositoryException {
         return (PropertyState) getItemState();
     }
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java Tue Mar 20 01:22:22 2007
@@ -22,15 +22,13 @@
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.Status;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateFactory;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.commons.collections.map.ReferenceMap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
 import java.util.Map;
 import java.util.Iterator;
 
@@ -71,17 +69,11 @@
         return (entry != null) ? entry : null;
     }
 
-    public NodeEntry resolve(NodeId nodeId, NodeEntry rootEntry) throws PathNotFoundException, RepositoryException {
+    public NodeEntry resolve(NodeId nodeId, NodeEntry rootEntry) throws ItemNotFoundException, RepositoryException {
         NodeEntry entry = lookup(nodeId);
         if (entry == null) {
-            try {
-                NodeState state = isf.createDeepNodeState(nodeId, rootEntry);
-                entry = state.getNodeEntry();
-            } catch (NoSuchItemStateException e) {
-                throw new PathNotFoundException(e);
-            } catch (ItemStateException e) {
-                throw new RepositoryException(e);
-            }
+            NodeState state = isf.createDeepNodeState(nodeId, rootEntry);
+            entry = state.getNodeEntry();
         }
         return entry;
     }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java Tue Mar 20 01:22:22 2007
@@ -28,7 +28,6 @@
 import org.apache.jackrabbit.jcr2spi.operation.LockRefresh;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.Status;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateLifeCycleListener;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
@@ -307,8 +306,9 @@
         }
         try {
             return entry.getNodeState();
-        } catch (ItemStateException e) {
-            // may occur if the nodeState is not accessible
+        } catch (RepositoryException e) {
+            // may occur if the nodeState is not accessible or some generic
+            // error occured.
             // for this case, assume that no lock exists and delegate final
             // validation to the spi-implementation.
             log.warn("Error while accessing lock holding NodeState", e);
@@ -335,13 +335,13 @@
             if (lockedEntry.denotesNode()) {
                 try {
                     lockHoldingState = ((NodeEntry) lockedEntry).getNodeState();
-                } catch (ItemStateException e) {
+                } catch (RepositoryException e) {
                     log.warn("Cannot build LockState");
                     throw new RepositoryException("Cannot build LockState", e);
                 }
             } else {
                 // should never occur
-                throw new RepositoryException("Internal error.");
+                throw new RepositoryException("Internal error: NodeId points to a Property.");
             }
         }
 
@@ -369,12 +369,7 @@
         NodeState nState = nodeState;
         // access first non-NEW state
         while (nState.getStatus() == Status.NEW) {
-            try {
-                nState = nState.getParent();
-            } catch (ItemStateException e) {
-                // should never occur, since NEW states must have an accessible parent
-                throw new RepositoryException("Intenal error", e);
-            }
+            nState = nState.getParent();
         }
 
         // shortcut: check if a given state holds a lock, which has been
@@ -541,7 +536,7 @@
                 try {
                     PropertyState ps = lockHoldingState.getPropertyState(QName.JCR_LOCKISDEEP);
                     ps.addListener(this);
-                } catch (ItemStateException e) {
+                } catch (RepositoryException e) {
                     log.warn("Internal error", e);
                 }
             }
@@ -552,7 +547,7 @@
                 try {
                     PropertyState ps = lockHoldingState.getPropertyState(QName.JCR_LOCKISDEEP);
                     ps.removeListener(this);
-                } catch (ItemStateException e) {
+                } catch (RepositoryException e) {
                     log.warn("Internal error", e);
                 }
             }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java Tue Mar 20 01:22:22 2007
@@ -20,8 +20,6 @@
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
@@ -35,6 +33,7 @@
 import javax.jcr.AccessDeniedException;
 import javax.jcr.ItemExistsException;
 import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.ItemNotFoundException;
 import javax.jcr.version.VersionException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -175,10 +174,8 @@
                 if (!existing.getNodeState().getDefinition().allowsSameNameSiblings()) {
                     throw new ItemExistsException("Node existing at move destination does not allow same name siblings.");
                 }
-            } catch (NoSuchItemStateException e) {
+            } catch (ItemNotFoundException e) {
                 // existing apparent not valid any more -> probably no conflict
-            } catch (ItemStateException e) {
-                throw new RepositoryException(e);
             }
         }
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Remove.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Remove.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Remove.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Remove.java Tue Mar 20 01:22:22 2007
@@ -18,7 +18,6 @@
 
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.spi.ItemId;
 
@@ -78,10 +77,6 @@
 
     //------------------------------------------------------------< Factory >---
     public static Operation create(ItemState state) throws RepositoryException {
-        try {
-            return new Remove(state, state.getParent());
-        } catch (ItemStateException e) {
-            throw new RepositoryException(e);
-        }
+        return new Remove(state, state.getParent());
     }
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ReorderNodes.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ReorderNodes.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ReorderNodes.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ReorderNodes.java Tue Mar 20 01:22:22 2007
@@ -17,8 +17,6 @@
 package org.apache.jackrabbit.jcr2spi.operation;
 
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
-import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.spi.NodeId;
@@ -27,6 +25,7 @@
 import javax.jcr.AccessDeniedException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
 import javax.jcr.version.VersionException;
 
 /**
@@ -101,7 +100,7 @@
     //------------------------------------------------------------< Factory >---
 
     public static Operation create(NodeState parentState, Path.PathElement srcName,
-                                   Path.PathElement beforeName) throws NoSuchItemStateException, ItemStateException {
+                                   Path.PathElement beforeName) throws ItemNotFoundException, RepositoryException {
         NodeState insert = parentState.getChildNodeState(srcName.getName(), srcName.getNormalizedIndex());
         NodeState before = (beforeName == null) ? null : parentState.getChildNodeState(beforeName.getName(), beforeName.getNormalizedIndex());
         return new ReorderNodes(parentState, insert, before);

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java Tue Mar 20 01:22:22 2007
@@ -18,7 +18,6 @@
 
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
@@ -52,7 +51,7 @@
         if (pe != null) {
             try {
                 addAffectedItemState(pe.getPropertyState());
-            } catch (ItemStateException e) {
+            } catch (RepositoryException e) {
                 // should never occur
             }
         }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java Tue Mar 20 01:22:22 2007
@@ -26,6 +26,7 @@
 import org.apache.commons.collections.iterators.IteratorChain;
 
 import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.RepositoryException;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.LinkedHashSet;
@@ -128,7 +129,7 @@
     /**
      * Revert the changes listed within this changelog
      */
-    public void undo() throws ItemStateException {
+    public void undo() throws RepositoryException {
         // TODO: check if states are reverted in the correct order
         Iterator[] its = new Iterator[] {addedStates(), deletedStates(), modifiedStates()};
         IteratorChain chain = new IteratorChain(its);
@@ -290,7 +291,7 @@
                                     }
                                 }
                             }
-                        } catch (ItemStateException e) {
+                        } catch (RepositoryException e) {
                             // should never occur -> ignore
                         }
                     }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java Tue Mar 20 01:22:22 2007
@@ -33,6 +33,7 @@
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Collections;
@@ -196,10 +197,10 @@
      * hierarchy entry}.
      *
      * @return
-     * @throws NoSuchItemStateException
-     * @throws ItemStateException
+     * @throws ItemNotFoundException
+     * @throws RepositoryException
      */
-    public NodeState getParent() throws NoSuchItemStateException, ItemStateException {
+    public NodeState getParent() throws ItemNotFoundException, RepositoryException {
         return getHierarchyEntry().getParent().getNodeState();
     }
 
@@ -422,10 +423,10 @@
      * the parent must already be connected to its overlayed state.
      *
      * @param keepChanges
-     * @throws NoSuchItemStateException
-     * @throws ItemStateException
+     * @throws ItemNotFoundException
+     * @throws RepositoryException
      */
-    public void reconnect(boolean keepChanges) throws NoSuchItemStateException, ItemStateException {
+    public void reconnect(boolean keepChanges) throws ItemNotFoundException, RepositoryException {
         checkIsSessionState();
         // Need to use the workspace-ISF in order not to create a session-state.
         ItemStateFactory wspIsf;
@@ -504,8 +505,6 @@
             evaluated upon creating the workspace state.
             */
             return getNodeTypeRegistry().getEffectiveNodeType(getParent().getNodeTypeNames());
-        } catch (ItemStateException e) {
-            throw new RepositoryException("Error while accessing Definition ", e);
         } catch (NodeTypeConflictException e) {
             throw new RepositoryException("Error while accessing Definition ", e);
         }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java Tue Mar 20 01:22:22 2007
@@ -21,6 +21,8 @@
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 
+import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
 import java.util.Iterator;
 
 /**
@@ -31,12 +33,12 @@
 public interface ItemStateFactory {
 
     /**
-     *
      * @param entry
      * @return
-     * @throws ItemStateException
+     * @throws ItemNotFoundException
+     * @throws RepositoryException
      */
-    public NodeState createRootState(NodeEntry entry) throws ItemStateException;
+    public NodeState createRootState(NodeEntry entry) throws ItemNotFoundException, RepositoryException;
 
     /**
      * Creates the child <code>NodeState</code> with the given
@@ -46,11 +48,11 @@
      * @param entry the <code>HierarchyEntry</code> the new state should
      * be attached to.
      * @return the created <code>NodeState</code>.
-     * @throws NoSuchItemStateException if there is no such <code>NodeState</code>.
-     * @throws ItemStateException if an error occurs while retrieving the <code>NodeState</code>.
+     * @throws ItemNotFoundException if there is no such <code>NodeState</code>.
+     * @throws RepositoryException if an error occurs while retrieving the <code>NodeState</code>.
      */
     public NodeState createNodeState(NodeId nodeId, NodeEntry entry)
-        throws NoSuchItemStateException, ItemStateException;
+            throws ItemNotFoundException, RepositoryException;
 
 
     /**
@@ -61,10 +63,11 @@
      * @param nodeId
      * @param anyParent
      * @return the created <code>NodeState</code>.
-     * @throws NoSuchItemStateException if there is no such <code>NodeState</code>.
-     * @throws ItemStateException if an error occurs while retrieving the <code>NodeState</code>.
+     * @throws ItemNotFoundException if there is no such <code>NodeState</code>.
+     * @throws RepositoryException if an error occurs while retrieving the <code>NodeState</code>.
      */
-    public NodeState createDeepNodeState(NodeId nodeId, NodeEntry anyParent) throws NoSuchItemStateException, ItemStateException;
+    public NodeState createDeepNodeState(NodeId nodeId, NodeEntry anyParent)
+            throws ItemNotFoundException, RepositoryException;
 
 
     /**
@@ -75,12 +78,12 @@
      * @param entry the <code>HierarchyEntry</code> the new state should
      * be attached to.
      * @return the created <code>PropertyState</code>.
-     * @throws NoSuchItemStateException if there is no such <code>PropertyState</code>.
-     * @throws ItemStateException       if an error occurs while retrieving the
-     *                                  <code>PropertyState</code>.
+     * @throws ItemNotFoundException if there is no such <code>PropertyState</code>.
+     * @throws RepositoryException if an error occurs while retrieving the
+     * <code>PropertyState</code>.
      */
     public PropertyState createPropertyState(PropertyId propertyId, PropertyEntry entry)
-        throws NoSuchItemStateException, ItemStateException;
+            throws ItemNotFoundException, RepositoryException;
 
 
     /**
@@ -91,17 +94,19 @@
      * @param propertyId
      * @param anyParent
      * @return
-     * @throws NoSuchItemStateException if there is no such <code>NodeState</code>.
-     * @throws ItemStateException if an error occurs while retrieving the <code>NodeState</code>.
+     * @throws ItemNotFoundException if there is no such <code>NodeState</code>.
+     * @throws RepositoryException if an error occurs while retrieving the <code>NodeState</code>.
      */
-    public PropertyState createDeepPropertyState(PropertyId propertyId, NodeEntry anyParent) throws NoSuchItemStateException, ItemStateException;
+    public PropertyState createDeepPropertyState(PropertyId propertyId, NodeEntry anyParent) throws ItemNotFoundException, RepositoryException;
 
     /**
      * Returns an Iterator over <code>ChildInfo</code>s for the given <code>NodeState</code>.
      *
      * @param nodeId
+     * @throws ItemNotFoundException
+     * @throws RepositoryException
      */
-    public Iterator getChildNodeInfos(NodeId nodeId) throws NoSuchItemStateException, ItemStateException;
+    public Iterator getChildNodeInfos(NodeId nodeId) throws ItemNotFoundException, RepositoryException;
 
     /**
      * Returns the NodeReferences for the NodeState with the given ID.

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java Tue Mar 20 01:22:22 2007
@@ -202,7 +202,7 @@
                             allNtNames[i] = values[i].getQName();
                         }
                         allNtNames[values.length] = primaryType;
-                    } catch (ItemStateException e) {
+                    } catch (RepositoryException e) {
                         // ignore
                     }
                 }
@@ -405,15 +405,9 @@
         VersionException, LockException, ItemNotFoundException,
         ItemExistsException, PathNotFoundException, RepositoryException {
 
-        try {
-            NodeState parent = propState.getParent();
-            QPropertyDefinition def = propState.getDefinition();
-            checkWriteProperty(parent, propState.getQName(), def, options);
-        } catch (NoSuchItemStateException e) {
-            throw new ItemNotFoundException(e);
-        } catch (ItemStateException e) {
-            throw new RepositoryException(e);
-        }
+        NodeState parent = propState.getParent();
+        QPropertyDefinition def = propState.getDefinition();
+        checkWriteProperty(parent, propState.getQName(), def, options);
     }
 
     /**
@@ -590,13 +584,7 @@
             throw new ConstraintViolationException("Cannot remove root node.");
         }
         // check parent
-        try {
-            checkIsWritable(targetState.getParent(), options);
-        } catch (NoSuchItemStateException e) {
-            throw new ItemNotFoundException(e);
-        } catch (ItemStateException e) {
-            throw new RepositoryException(e);
-        }
+        checkIsWritable(targetState.getParent(), options);
 
         // access rights
         if ((options & CHECK_ACCESS) == CHECK_ACCESS) {
@@ -605,10 +593,10 @@
                 if (!mgrProvider.getAccessManager().canRemove(targetState)) {
                     throw new AccessDeniedException(safeGetJCRPath(targetState) + ": not allowed to remove node");
                 }
-            } catch (ItemNotFoundException infe) {
+            } catch (ItemNotFoundException e) {
                 String msg = "internal error: failed to check access rights for " + safeGetJCRPath(targetState);
                 log.debug(msg);
-                throw new RepositoryException(msg, infe);
+                throw new RepositoryException(msg, e);
             }
         }
 
@@ -635,14 +623,9 @@
      */
     private void checkIsCheckedOut(ItemState itemState)
             throws PathNotFoundException, VersionException, RepositoryException {
-        try {
-            NodeState nodeState = (itemState.isNode()) ? (NodeState)itemState : itemState.getParent();
-            mgrProvider.getVersionManager().checkIsCheckedOut(nodeState);
-        } catch (NoSuchItemStateException e) {
-            throw new ItemNotFoundException(e);
-        } catch (ItemStateException e) {
-            throw new RepositoryException(e);
-        }
+
+        NodeState nodeState = (itemState.isNode()) ? (NodeState)itemState : itemState.getParent();
+        mgrProvider.getVersionManager().checkIsCheckedOut(nodeState);
     }
 
     /**
@@ -655,16 +638,10 @@
      * @throws RepositoryException   if another error occurs
      */
     private void checkLock(ItemState itemState) throws LockException, RepositoryException {
-        try {
-            // make sure there's no foreign lock present the node (or the parent node
-            // in case the state represents a PropertyState).
-            NodeState nodeState = (itemState.isNode()) ? ((NodeState)itemState) : itemState.getParent();
-            mgrProvider.getLockManager().checkLock(nodeState);
-        } catch (NoSuchItemStateException e) {
-            throw new ItemNotFoundException(e);
-        } catch (ItemStateException e) {
-            throw new RepositoryException(e);
-        }
+        // make sure there's no foreign lock present the node (or the parent node
+        // in case the state represents a PropertyState).
+        NodeState nodeState = (itemState.isNode()) ? ((NodeState)itemState) : itemState.getParent();
+        mgrProvider.getLockManager().checkLock(nodeState);
     }
 
     /**
@@ -741,11 +718,11 @@
         if (pe != null) {
             try {
                 pe.getPropertyState();
-            } catch (ItemStateException e) {
-                // should not occur. existance has been asserted before
-                throw new RepositoryException(e);
+                throw new ItemExistsException("Property '" + pe.getQName() + "' already exists.");
+            } catch (ItemNotFoundException e) {
+                // apparently conflicting entry does not exist any more
+                // ignore and return
             }
-            throw new ItemExistsException("Property '" + pe.getQName() + "' already exists.");
         }
     }
 
@@ -779,11 +756,8 @@
                         + safeGetJCRPath(parentState)
                         + ": colliding with same-named existing node.");
                 }
-            } catch (NoSuchItemStateException e) {
+            } catch (ItemNotFoundException e) {
                 // ignore: conflicting doesn't exist any more
-            } catch (ItemStateException e) {
-                // should not occur, since existence has been asserted before
-                throw new RepositoryException(e);
             }
         }
     }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?view=diff&rev=520315&r1=520314&r2=520315
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java Tue Mar 20 01:22:22 2007
@@ -31,6 +31,7 @@
 import org.slf4j.Logger;
 
 import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
 import java.util.ArrayList;
 
 import java.util.HashMap;
@@ -287,16 +288,16 @@
      * @param nodeName <code>QName</code> object specifying a node name.
      * @param index 1-based index if there are same-name child node entries.
      * @return The <code>NodeState</code> with the specified name and index
-     * @throws NoSuchItemStateException
-     * @throws ItemStateException
+     * @throws ItemNotFoundException
+     * @throws RepositoryException
      */
-    public NodeState getChildNodeState(QName nodeName, int index) throws NoSuchItemStateException, ItemStateException {
+    public NodeState getChildNodeState(QName nodeName, int index) throws ItemNotFoundException, RepositoryException {
         NodeEntry child = getNodeEntry().getNodeEntry(nodeName, index);
         if (child != null) {
             return child.getNodeState();
         } else {
             // TODO: correct?
-            throw new NoSuchItemStateException("Child node "+ nodeName +" with index " + index + " does not exist.");
+            throw new ItemNotFoundException("Child node "+ nodeName +" with index " + index + " does not exist.");
         }
     }
 
@@ -315,21 +316,21 @@
      * Utility method that returns the property state with the given name.
      *
      * @param propertyName The name of the property state to return.
-     * @throws NoSuchItemStateException If there is no (valid) property state
+     * @throws ItemNotFoundException If there is no (valid) property state
      * with the given name.
-     * @throws ItemStateException If an error occurs while retrieving the
+     * @throws RepositoryException If an error occurs while retrieving the
      * property state.
      *
      * @see NodeEntry#getPropertyEntry(QName)
      * @see PropertyEntry#getPropertyState()
      */
-    public PropertyState getPropertyState(QName propertyName) throws NoSuchItemStateException, ItemStateException {
+    public PropertyState getPropertyState(QName propertyName) throws ItemNotFoundException, RepositoryException {
         PropertyEntry child = getNodeEntry().getPropertyEntry(propertyName);
         if (child != null) {
             return child.getPropertyState();
         } else {
             // TODO; correct?
-            throw new NoSuchItemStateException("Child Property with name " + propertyName + " does not exist.");
+            throw new ItemNotFoundException("Child Property with name " + propertyName + " does not exist.");
         }
     }
 
@@ -337,8 +338,7 @@
      * {@inheritDoc}
      * @see ItemState#persisted(ChangeLog, CacheBehaviour)
      */
-    void persisted(ChangeLog changeLog, CacheBehaviour cacheBehaviour)
-        throws IllegalStateException {
+    void persisted(ChangeLog changeLog, CacheBehaviour cacheBehaviour) throws IllegalStateException {
         checkIsSessionState();
 
         // remember parent states that have need to adjust their uniqueID/mixintypes
@@ -353,13 +353,16 @@
             delState.getHierarchyEntry().remove();
 
             // adjust parent states unless the parent is removed as well
-            try {
-                NodeState parent = delState.getParent();
-                if (!changeLog.containsDeletedState(parent)) {
-                    modifiedParent(parent, delState, modParents);
+            if (delState.getHierarchyEntry().getParent().isAvailable()) {
+                try {
+                    NodeState parent = delState.getParent();
+                    if (!changeLog.containsDeletedState(parent)) {
+                        modifiedParent(parent, delState, modParents);
+                    }
+                } catch (RepositoryException e) {
+                    // ignore. if parent state cannot be retrieved for whatever
+                    // reason, it doesn't need to be adjusted
                 }
-            } catch (ItemStateException e) {
-                // ignore. if parent state does not exist it doesn't need to be adjusted
             }
         }
 
@@ -380,7 +383,7 @@
                     modifiedParent(parent, addedState, modParents);
                 }
                 it.remove();
-            } catch (ItemStateException e) {
+            } catch (RepositoryException e) {
                 // should never occur
                 log.error("Internal error:", e.getMessage());
             }
@@ -413,10 +416,10 @@
                 if (QName.JCR_MIXINTYPES.equals(modState.getQName())) {
                     try {
                         modifiedParent(modState.getParent(), modState, modParents);
-                    } catch (ItemStateException e) {
+                    } catch (RepositoryException e) {
                         // should never occur. since parent must be available otherwise
                         // the mixin could not been added/removed.
-                        log.error("Internal error:", e.getMessage());
+                        log.warn("Internal error:", e.getMessage());
                     }
                 }
                 it.remove();
@@ -456,11 +459,11 @@
      * @param beforeNode the child node where to insert the node before. If
      * <code>null</code> the child node <code>insertNode</code> is moved to the
      * end of the child node entries.
-     * @throws NoSuchItemStateException if <code>insertNode</code> or
+     * @throws ItemNotFoundException if <code>insertNode</code> or
      * <code>beforeNode</code> is not a child node of this <code>NodeState</code>.
      */
     synchronized void reorderChildNodeEntries(NodeState insertNode, NodeState beforeNode)
-        throws NoSuchItemStateException {
+        throws ItemNotFoundException {
         checkIsSessionState();
 
         NodeEntry before = (beforeNode == null) ? null : beforeNode.getNodeEntry();
@@ -532,7 +535,7 @@
                         // retrieve uuid from persistent layer
                         try {
                             propState.reconnect(false);
-                        } catch (ItemStateException e) {
+                        } catch (RepositoryException e) {
                             // TODO: handle properly
                             log.error("Internal error", e);
                         }
@@ -550,7 +553,7 @@
                 // TODO: really necessary???
                 try {
                     parent.reconnect(false);
-                } catch (ItemStateException e) {
+                } catch (RepositoryException e) {
                     // TODO: handle properly
                     log.error("Internal error", e);
                 }



Mime
View raw message