jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r808007 - /jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
Date Wed, 26 Aug 2009 13:40:00 GMT
Author: mduerig
Date: Wed Aug 26 13:39:59 2009
New Revision: 808007

URL: http://svn.apache.org/viewvc?rev=808007&view=rev
Log:
JCR-2279: Improve reusability of AbstractRepositoryService and AbstractReadableRepositoryService

Modified:
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java?rev=808007&r1=808006&r2=808007&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
Wed Aug 26 13:39:59 2009
@@ -21,6 +21,7 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -32,6 +33,7 @@
 import javax.jcr.UnsupportedRepositoryOperationException;
 
 import org.apache.jackrabbit.spi.ItemId;
+import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.NodeInfo;
 import org.apache.jackrabbit.spi.QValue;
@@ -126,7 +128,13 @@
     public NodeInfo getNodeInfo(SessionInfo sessionInfo, NodeId nodeId) throws ItemNotFoundException,
             RepositoryException {
 
-        return (NodeInfo) getItemInfos(sessionInfo, nodeId).next();
+        Iterator<? extends ItemInfo> infos = getItemInfos(sessionInfo, nodeId);
+        if (infos.hasNext()) {
+            return (NodeInfo) infos.next();
+        }
+        else {
+            throw new ItemNotFoundException();
+        }
     }
 
     //-------------------------< workspace names >------------------------------



Mime
View raw message