jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1342284 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/api/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/
Date Thu, 24 May 2012 14:21:02 GMT
Author: mduerig
Date: Thu May 24 14:21:01 2012
New Revision: 1342284

URL: http://svn.apache.org/viewvc?rev=1342284&view=rev
Log:
OAK-37: Use nullability annotation to enforce/document API contract
- add nullability annotations to Root

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java?rev=1342284&r1=1342283&r2=1342284&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java Thu
May 24 14:21:01 2012
@@ -18,6 +18,8 @@
  */
 package org.apache.jackrabbit.oak.api;
 
+import javax.annotation.CheckForNull;
+
 /**
  * The root of a {@link Tree}.
  */
@@ -56,6 +58,7 @@ public interface Root {
      * @param path  path to the tree
      * @return  tree at the given path or {@code null} if no such tree exists
      */
+    @CheckForNull
     Tree getTree(String path);
 
     /**

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java?rev=1342284&r1=1342283&r2=1342284&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
Thu May 24 14:21:01 2012
@@ -196,6 +196,10 @@ public class NamespaceMappings {
 
     private Tree getNamespaces(Root root, boolean create) {
         Tree tree = root.getTree("/");
+        if (tree == null) {
+            throw new IllegalStateException("No root node");
+        }
+
         Tree system = tree.getChild("jcr:system");
         if (system == null) {
             if (create) {

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=1342284&r1=1342283&r2=1342284&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 May 24 14:21:01 2012
@@ -19,13 +19,11 @@ package org.apache.jackrabbit.oak.jcr;
 import org.apache.jackrabbit.oak.api.AuthInfo;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.jcr.namespace.NamespaceRegistryImpl;
-import org.apache.jackrabbit.oak.jcr.query.QueryImpl;
 import org.apache.jackrabbit.oak.jcr.query.QueryManagerImpl;
 import org.apache.jackrabbit.oak.jcr.value.ValueFactoryImpl;
 import org.apache.jackrabbit.oak.namepath.AbstractNameMapper;
@@ -115,7 +113,12 @@ public class SessionDelegate {
 
     @Nonnull
     public NodeDelegate getRoot() {
-        return new NodeDelegate(this, getTree(""));
+        Tree root = getTree("");
+        if (root == null) {
+            throw new IllegalStateException("No root node");
+        }
+
+        return new NodeDelegate(this, root);
     }
 
     @CheckForNull
@@ -385,6 +388,7 @@ public class SessionDelegate {
 
     //------------------------------------------------------------< internal >---
 
+    @CheckForNull
     Tree getTree(String path) {
         return root.getTree(path);
     }



Mime
View raw message