jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1368403 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: SessionDelegate.java SessionImpl.java
Date Thu, 02 Aug 2012 09:48:25 GMT
Author: angela
Date: Thu Aug  2 09:48:25 2012
New Revision: 1368403

URL: http://svn.apache.org/viewvc?rev=1368403&view=rev
Log:
OAK-219 : SessionDelegate#getRoot throws IllegalStateException if the root node is not accessible

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1368403&r1=1368402&r2=1368403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Thu Aug  2 09:48:25 2012
@@ -21,7 +21,6 @@ import java.text.ParseException;
 import java.util.Collections;
 import java.util.Map;
 import java.util.Timer;
-
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.jcr.ItemExistsException;
@@ -165,14 +164,14 @@ public class SessionDelegate {
         }
     }
 
-    @Nonnull
+    @CheckForNull
     public NodeDelegate getRoot() {
         Tree root = getTree("");
         if (root == null) {
-            throw new IllegalStateException("No root node");
+            return null;
+        } else {
+            return new NodeDelegate(this, root);
         }
-
-        return new NodeDelegate(this, root);
     }
 
     @CheckForNull

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1368403&r1=1368402&r2=1368403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Thu Aug  2 09:48:25 2012
@@ -23,6 +23,7 @@ import java.util.Map;
 import java.util.Set;
 
 import javax.annotation.Nonnull;
+import javax.jcr.AccessDeniedException;
 import javax.jcr.Credentials;
 import javax.jcr.Item;
 import javax.jcr.ItemNotFoundException;
@@ -123,8 +124,13 @@ public class SessionImpl extends Abstrac
 
         return dlg.perform(new SessionOperation<NodeImpl>() {
             @Override
-            public NodeImpl perform() {
-                return new NodeImpl(dlg.getRoot());
+            public NodeImpl perform() throws AccessDeniedException {
+                NodeDelegate nd = dlg.getRoot();
+                if (nd == null) {
+                    throw new AccessDeniedException("Root node is not accessible.");
+                } else {
+                    return new NodeImpl(dlg.getRoot());
+                }
             }
         });
     }



Mime
View raw message