You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ch...@apache.org on 2013/12/13 14:08:57 UTC

svn commit: r1550719 - in /jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ItemManager.java ItemManagerImpl.java LazyItemIterator.java

Author: chetanm
Date: Fri Dec 13 13:08:57 2013
New Revision: 1550719

URL: http://svn.apache.org/r1550719
Log:
JCR-3629 - [jcr2spi]RepositoryException lost in org.apache.jackrabbit.jcr2spi.ItemManagerImpl while querying on remote nodes exposed by jackrabbit-spi

Merging revision 1507190 from trunk

Modified:
    jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java
    jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
    jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/LazyItemIterator.java

Modified: jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java?rev=1550719&r1=1550718&r2=1550719&view=diff
==============================================================================
--- jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java (original)
+++ jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java Fri Dec 13 13:08:57 2013
@@ -63,24 +63,27 @@ public interface ItemManager {
      *
      * @param path path to the node to be checked
      * @return true if the specified item exists
+     * @throws RepositoryException
      */
-    public boolean nodeExists(Path path);
+    public boolean nodeExists(Path path) throws RepositoryException;
 
     /**
      * Checks if the property with the given path exists.
      *
      * @param path path to the property to be checked
      * @return true if the specified item exists
+     * @throws RepositoryException
      */
-    public boolean propertyExists(Path path);
+    public boolean propertyExists(Path path) throws RepositoryException;
 
     /**
      * Checks if the item for given HierarchyEntry exists.
      *
      * @param hierarchyEntry
      * @return true if the specified item exists
+      @throws RepositoryException
      */
-    public boolean itemExists(HierarchyEntry hierarchyEntry);
+    public boolean itemExists(HierarchyEntry hierarchyEntry) throws RepositoryException;
 
     /**
      *

Modified: jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java?rev=1550719&r1=1550718&r2=1550719&view=diff
==============================================================================
--- jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java (original)
+++ jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java Fri Dec 13 13:08:57 2013
@@ -104,7 +104,7 @@ public class ItemManagerImpl implements 
     /**
      * @see ItemManager#nodeExists(Path)
      */
-    public boolean nodeExists(Path path) {
+    public boolean nodeExists(Path path) throws RepositoryException {
         try {
             // session-sanity & permissions are checked upon itemExists(ItemState)
             NodeState nodeState = hierMgr.getNodeState(path);
@@ -113,15 +113,13 @@ public class ItemManagerImpl implements 
             return false;
         } catch (ItemNotFoundException infe) {
             return false;
-        } catch (RepositoryException re) {
-            return false;
         }
     }
 
     /**
      * @see ItemManager#propertyExists(Path)
      */
-    public boolean propertyExists(Path path) {
+    public boolean propertyExists(Path path) throws RepositoryException {
         try {
             // session-sanity & permissions are checked upon itemExists(ItemState)
             PropertyState propState = hierMgr.getPropertyState(path);
@@ -130,23 +128,19 @@ public class ItemManagerImpl implements 
             return false;
         } catch (ItemNotFoundException infe) {
             return false;
-        } catch (RepositoryException re) {
-            return false;
         }
     }
 
     /**
      * @see ItemManager#itemExists(HierarchyEntry)
      */
-    public boolean itemExists(HierarchyEntry hierarchyEntry) {
+    public boolean itemExists(HierarchyEntry hierarchyEntry) throws RepositoryException {
         try {
             // session-sanity & permissions are checked upon itemExists(ItemState)
             ItemState state = hierarchyEntry.getItemState();
             return itemExists(state);
         } catch (ItemNotFoundException e) {
             return false;
-        } catch (RepositoryException e) {
-            return false;
         }
     }
 

Modified: jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/LazyItemIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/LazyItemIterator.java?rev=1550719&r1=1550718&r2=1550719&view=diff
==============================================================================
--- jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/LazyItemIterator.java (original)
+++ jackrabbit/branches/2.1/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/LazyItemIterator.java Fri Dec 13 13:08:57 2013
@@ -219,9 +219,17 @@ public class LazyItemIterator implements
             pos++;
             HierarchyEntry entry = iter.next();
             // check if item exists but don't build Item instance.
-            while (!itemMgr.itemExists(entry)) {
-                log.debug("Ignoring nonexistent item " + entry);
-                entry = iter.next();
+            boolean itemExists = false;
+            while(!itemExists){
+                try{
+                    itemExists = itemMgr.itemExists(entry);
+                }catch(RepositoryException e){
+                    log.warn("Failed to check that item {} exists",entry,e);
+                }
+                if(!itemExists){
+                    log.debug("Ignoring nonexistent item {}", entry);
+                    entry = iter.next();
+                }
             }
         }
         // fetch final item (the one to be returned on next())