jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1477009 [2/3] - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/api/ oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/ oak-core/src/main/java/or...
Date Mon, 29 Apr 2013 12:42:01 GMT
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java Mon Apr 29 12:41:59 2013
@@ -127,7 +127,7 @@ class UserValidator extends DefaultValid
 
     @Override
     public Validator childNodeAdded(String name, NodeState after) throws CommitFailedException {
-        Tree tree = checkNotNull(parentAfter.getChild(name));
+        Tree tree = checkNotNull(parentAfter.getChildOrNull(name));
 
         AuthorizableType type = UserUtility.getType(tree);
         String authRoot = UserUtility.getAuthorizableRootPath(provider.getConfig(), type);
@@ -145,12 +145,12 @@ class UserValidator extends DefaultValid
     @Override
     public Validator childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException {
         // TODO: anything to do here?
-        return new UserValidator(parentBefore.getChild(name), parentAfter.getChild(name), provider);
+        return new UserValidator(parentBefore.getChildOrNull(name), parentAfter.getChildOrNull(name), provider);
     }
 
     @Override
     public Validator childNodeDeleted(String name, NodeState before) throws CommitFailedException {
-        Tree node = parentBefore.getChild(name);
+        Tree node = parentBefore.getChildOrNull(name);
         if (isAdminUser(node)) {
             String msg = "The admin user cannot be removed.";
             throw constraintViolation(27, msg);
@@ -195,13 +195,13 @@ class UserValidator extends DefaultValid
             String msg = "Attempt to create user/group outside of configured scope " + pathConstraint;
             throw constraintViolation(28, msg);
         }
-        Tree parent = tree.getParent();
+        Tree parent = tree.getParentOrNull();
         while (parent != null && !parent.isRoot()) {
             if (!NT_REP_AUTHORIZABLE_FOLDER.equals(TreeUtil.getPrimaryTypeName(parent))) {
                 String msg = "Cannot create user/group: Intermediate folders must be of type rep:AuthorizableFolder.";
                 throw constraintViolation(29, msg);
             }
-            parent = parent.getParent();
+            parent = parent.getParentOrNull();
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/ResultRowToAuthorizable.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/ResultRowToAuthorizable.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/ResultRowToAuthorizable.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/ResultRowToAuthorizable.java Mon Apr 29 12:41:59 2013
@@ -64,10 +64,10 @@ class ResultRowToAuthorizable implements
     private Authorizable getAuthorizable(String resultPath) {
         Authorizable authorizable = null;
         try {
-            Tree tree = root.getTree(resultPath);
+            Tree tree = root.getTreeOrNull(resultPath);
             AuthorizableType type = UserUtility.getType(tree);
             while (tree != null && type == null) {
-                tree = tree.getParent();
+                tree = tree.getParentOrNull();
                 type = UserUtility.getType(tree);
             }
             if (tree != null && (targetType == null || targetType == type)) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java Mon Apr 29 12:41:59 2013
@@ -25,8 +25,6 @@ import static org.apache.jackrabbit.oak.
 import static org.apache.jackrabbit.oak.api.Type.STRINGS;
 
 import java.util.Arrays;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
 import java.util.List;
 
 import javax.annotation.CheckForNull;
@@ -46,7 +44,6 @@ import org.apache.jackrabbit.oak.commons
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
-import org.apache.jackrabbit.oak.plugins.value.Conversions;
 import org.apache.jackrabbit.util.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -88,7 +85,7 @@ public class NodeUtil {
 
     @CheckForNull
     public NodeUtil getParent() {
-        return new NodeUtil(tree.getParent(), mapper);
+        return new NodeUtil(tree.getParentOrNull(), mapper);
     }
 
     public boolean isRoot() {
@@ -96,12 +93,12 @@ public class NodeUtil {
     }
 
     public boolean hasChild(String name) {
-        return tree.getChild(name) != null;
+        return tree.getChildOrNull(name) != null;
     }
 
     @CheckForNull
     public NodeUtil getChild(String name) {
-        Tree child = tree.getChild(name);
+        Tree child = tree.getChildOrNull(name);
         return (child == null) ? null : new NodeUtil(child, mapper);
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/ContentSessionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/ContentSessionTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/ContentSessionTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/ContentSessionTest.java Mon Apr 29 12:41:59 2013
@@ -54,15 +54,15 @@ public class ContentSessionTest extends 
         ContentSession session = repository.login(null, null);
         Root root = session.getLatestRoot();
         session.close();
-        root.getTree("/");
+        root.getTreeOrNull("/");
     }
 
     @Test(expected = IllegalStateException.class)
     public void throwOnClosedTree() throws LoginException, NoSuchWorkspaceException, IOException {
         ContentSession session = repository.login(null, null);
         Root root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         session.close();
-        tree.getChild("any");
+        tree.getChildOrNull("any");
     }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/QueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/QueryTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/QueryTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/QueryTest.java Mon Apr 29 12:41:59 2013
@@ -56,7 +56,7 @@ public class QueryTest {
     public void queryOnStableRevision() throws Exception {
         ContentSession s = repository.login(null, null);
         Root r = s.getLatestRoot();
-        Tree t = r.getTree("/").addChild("test");
+        Tree t = r.getTreeOrNull("/").addChild("test");
         t.addChild("node1").setProperty("jcr:primaryType", "nt:base");
         t.addChild("node2").setProperty("jcr:primaryType", "nt:base");
         t.addChild("node3").setProperty("jcr:primaryType", "nt:base");
@@ -65,7 +65,7 @@ public class QueryTest {
         ContentSession s2 = repository.login(null, null);
         Root r2 = s2.getLatestRoot();
 
-        r.getTree("/test").getChild("node2").remove();
+        r.getTreeOrNull("/test").getChildOrNull("node2").remove();
         r.commit();
 
         Result result = r2.getQueryEngine().executeQuery(

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/RootTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/RootTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/RootTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/RootTest.java Mon Apr 29 12:41:59 2013
@@ -54,7 +54,7 @@ public class RootTest {
         ContentSession s = repository.login(null, null);
         try {
             Root r = s.getLatestRoot();
-            Tree t = r.getTree("/");
+            Tree t = r.getTreeOrNull("/");
             Tree c = t.addChild("c");
             c.addChild("node1").orderBefore(null);
             c.addChild("node2");
@@ -75,7 +75,7 @@ public class RootTest {
         ContentSession s = repository.login(null, null);
         try {
             Root r = s.getLatestRoot();
-            Tree t = r.getTree("/");
+            Tree t = r.getTreeOrNull("/");
             Tree c = t.addChild("c");
             c.addChild("node1").orderBefore(null);
             c.addChild("node2");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/TreeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/TreeTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/TreeTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/TreeTest.java Mon Apr 29 12:41:59 2013
@@ -75,25 +75,25 @@ public class TreeTest {
         ContentSession s = repository.login(null, null);
         try {
             Root r = s.getLatestRoot();
-            Tree t = r.getTree("/");
+            Tree t = r.getTreeOrNull("/");
             t.addChild("node1");
             t.addChild("node2");
             t.addChild("node3");
             r.commit();
 
-            t.getChild("node1").orderBefore("node2");
-            t.getChild("node3").orderBefore(null);
+            t.getChildOrNull("node1").orderBefore("node2");
+            t.getChildOrNull("node3").orderBefore(null);
             assertSequence(t.getChildren(), "node1", "node2", "node3");
             r.commit();
             // check again after commit
             assertSequence(t.getChildren(), "node1", "node2", "node3");
 
-            t.getChild("node3").orderBefore("node2");
+            t.getChildOrNull("node3").orderBefore("node2");
             assertSequence(t.getChildren(), "node1", "node3", "node2");
             r.commit();
             assertSequence(t.getChildren(), "node1", "node3", "node2");
 
-            t.getChild("node1").orderBefore(null);
+            t.getChildOrNull("node1").orderBefore(null);
             assertSequence(t.getChildren(), "node3", "node2", "node1");
             r.commit();
             assertSequence(t.getChildren(), "node3", "node2", "node1");
@@ -111,7 +111,7 @@ public class TreeTest {
         ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
-            Tree t1 = r1.getTree("/");
+            Tree t1 = r1.getTreeOrNull("/");
             t1.addChild("node1");
             t1.addChild("node2");
             t1.addChild("node3");
@@ -120,22 +120,22 @@ public class TreeTest {
             ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
-                Tree t2 = r2.getTree("/");
+                Tree t2 = r2.getTreeOrNull("/");
 
-                t1.getChild("node2").orderBefore("node1");
-                t1.getChild("node3").orderBefore(null);
+                t1.getChildOrNull("node2").orderBefore("node1");
+                t1.getChildOrNull("node3").orderBefore(null);
                 r1.commit();
                 assertSequence(t1.getChildren(), "node2", "node1", "node3");
 
-                t2.getChild("node3").orderBefore("node1");
-                t2.getChild("node2").orderBefore(null);
+                t2.getChildOrNull("node3").orderBefore("node1");
+                t2.getChildOrNull("node2").orderBefore(null);
                 r2.commit();
                 // other session wins
                 assertSequence(t2.getChildren(), "node2", "node1", "node3");
 
                 // try again on current root
-                t2.getChild("node3").orderBefore("node1");
-                t2.getChild("node2").orderBefore(null);
+                t2.getChildOrNull("node3").orderBefore("node1");
+                t2.getChildOrNull("node2").orderBefore(null);
                 r2.commit();
                 assertSequence(t2.getChildren(), "node3", "node1", "node2");
 
@@ -152,7 +152,7 @@ public class TreeTest {
         ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
-            Tree t1 = r1.getTree("/");
+            Tree t1 = r1.getTreeOrNull("/");
             t1.addChild("node1");
             t1.addChild("node2");
             t1.addChild("node3");
@@ -161,21 +161,21 @@ public class TreeTest {
             ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
-                Tree t2 = r2.getTree("/");
+                Tree t2 = r2.getTreeOrNull("/");
 
-                t1.getChild("node2").orderBefore("node1");
-                t1.getChild("node3").orderBefore(null);
+                t1.getChildOrNull("node2").orderBefore("node1");
+                t1.getChildOrNull("node3").orderBefore(null);
                 t1.addChild("node4");
                 r1.commit();
                 assertSequence(t1.getChildren(), "node2", "node1", "node3", "node4");
 
-                t2.getChild("node3").orderBefore("node1");
+                t2.getChildOrNull("node3").orderBefore("node1");
                 r2.commit();
                 // other session wins
                 assertSequence(t2.getChildren(), "node2", "node1", "node3", "node4");
 
                 // try again on current root
-                t2.getChild("node3").orderBefore("node1");
+                t2.getChildOrNull("node3").orderBefore("node1");
                 r2.commit();
                 assertSequence(t2.getChildren(), "node2", "node3", "node1", "node4");
 
@@ -192,7 +192,7 @@ public class TreeTest {
         ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
-            Tree t1 = r1.getTree("/");
+            Tree t1 = r1.getTreeOrNull("/");
             t1.addChild("node1");
             t1.addChild("node2");
             t1.addChild("node3");
@@ -202,21 +202,21 @@ public class TreeTest {
             ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
-                Tree t2 = r2.getTree("/");
+                Tree t2 = r2.getTreeOrNull("/");
 
-                t1.getChild("node2").orderBefore("node1");
-                t1.getChild("node3").orderBefore(null);
-                t1.getChild("node4").remove();
+                t1.getChildOrNull("node2").orderBefore("node1");
+                t1.getChildOrNull("node3").orderBefore(null);
+                t1.getChildOrNull("node4").remove();
                 r1.commit();
                 assertSequence(t1.getChildren(), "node2", "node1", "node3");
 
-                t2.getChild("node3").orderBefore("node1");
+                t2.getChildOrNull("node3").orderBefore("node1");
                 r2.commit();
                 // other session wins
                 assertSequence(t2.getChildren(), "node2", "node1", "node3");
 
                 // try again on current root
-                t2.getChild("node3").orderBefore("node1");
+                t2.getChildOrNull("node3").orderBefore("node1");
                 r2.commit();
                 assertSequence(t2.getChildren(), "node2", "node3", "node1");
 
@@ -233,7 +233,7 @@ public class TreeTest {
         ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
-            Tree t1 = r1.getTree("/");
+            Tree t1 = r1.getTreeOrNull("/");
             t1.addChild("node1").orderBefore(null);
             t1.addChild("node2");
             t1.addChild("node3");
@@ -243,21 +243,21 @@ public class TreeTest {
             ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
-                Tree t2 = r2.getTree("/");
+                Tree t2 = r2.getTreeOrNull("/");
 
-                t1.getChild("node2").orderBefore("node1");
-                t1.getChild("node3").orderBefore(null);
+                t1.getChildOrNull("node2").orderBefore("node1");
+                t1.getChildOrNull("node3").orderBefore(null);
                 r1.commit();
                 assertSequence(t1.getChildren(), "node2", "node1", "node4", "node3");
 
-                t2.getChild("node3").orderBefore("node1");
-                t2.getChild("node4").remove();
+                t2.getChildOrNull("node3").orderBefore("node1");
+                t2.getChildOrNull("node4").remove();
                 r2.commit();
                 // other session wins wrt ordering, but node4 is gone
                 assertSequence(t2.getChildren(), "node2", "node1", "node3");
 
                 // try reorder again on current root
-                t2.getChild("node3").orderBefore("node1");
+                t2.getChildOrNull("node3").orderBefore("node1");
                 r2.commit();
                 assertSequence(t2.getChildren(), "node2", "node3", "node1");
 
@@ -274,7 +274,7 @@ public class TreeTest {
         ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
-            Tree t1 = r1.getTree("/");
+            Tree t1 = r1.getTreeOrNull("/");
             t1.addChild("node1");
             t1.addChild("node2");
             t1.addChild("node3");
@@ -283,14 +283,14 @@ public class TreeTest {
             ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
-                Tree t2 = r2.getTree("/");
+                Tree t2 = r2.getTreeOrNull("/");
 
-                t1.getChild("node2").orderBefore("node1");
-                t1.getChild("node3").remove();
+                t1.getChildOrNull("node2").orderBefore("node1");
+                t1.getChildOrNull("node3").remove();
                 r1.commit();
                 assertSequence(t1.getChildren(), "node2", "node1");
 
-                t2.getChild("node3").orderBefore("node1");
+                t2.getChildOrNull("node3").orderBefore("node1");
                 r2.commit();
                 assertSequence(t2.getChildren(), "node2", "node1");
 
@@ -307,7 +307,7 @@ public class TreeTest {
         ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
-            Tree t1 = r1.getTree("/").addChild("c");
+            Tree t1 = r1.getTreeOrNull("/").addChild("c");
             t1.addChild("node1").orderBefore(null);
             t1.addChild("node2");
             t1.addChild("node3");
@@ -316,15 +316,15 @@ public class TreeTest {
             ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
-                Tree t2 = r2.getTree("/c");
+                Tree t2 = r2.getTreeOrNull("/c");
 
                 t1.remove();
                 // now 'c' does not have ordered children anymore
-                r1.getTree("/").addChild("c");
+                r1.getTreeOrNull("/").addChild("c");
                 r1.commit();
                 assertSequence(t1.getChildren());
 
-                t2.getChild("node3").orderBefore("node1");
+                t2.getChildOrNull("node3").orderBefore("node1");
                 r2.commit();
                 assertSequence(t2.getChildren());
 
@@ -341,7 +341,7 @@ public class TreeTest {
         ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
-            Tree t1 = r1.getTree("/");
+            Tree t1 = r1.getTreeOrNull("/");
             t1.addChild("node1").orderBefore(null);
             t1.addChild("node2");
             t1.addChild("node3");
@@ -351,14 +351,14 @@ public class TreeTest {
             ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
-                Tree t2 = r2.getTree("/");
+                Tree t2 = r2.getTreeOrNull("/");
 
-                t1.getChild("node2").orderBefore("node1");
-                t1.getChild("node3").remove();
+                t1.getChildOrNull("node2").orderBefore("node1");
+                t1.getChildOrNull("node3").remove();
                 r1.commit();
                 assertSequence(t1.getChildren(), "node2", "node1", "node4");
 
-                t2.getChild("node4").orderBefore("node3");
+                t2.getChildOrNull("node4").orderBefore("node3");
                 r2.commit();
                 assertSequence(t2.getChildren(), "node2", "node1", "node4");
 
@@ -375,16 +375,16 @@ public class TreeTest {
         ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
-            Tree t1 = r1.getTree("/");
+            Tree t1 = r1.getTreeOrNull("/");
             t1.addChild("node1").orderBefore(null);
             t1.addChild("node2");
             r1.commit();
             ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
-                Tree t2 = r2.getTree("/");
+                Tree t2 = r2.getTreeOrNull("/");
 
-                t1 = r1.getTree("/");
+                t1 = r1.getTreeOrNull("/");
                 // node3 from s1
                 t1.addChild("node3");
                 r1.commit();
@@ -393,7 +393,7 @@ public class TreeTest {
                 t2.addChild("node4");
                 r2.commit();
 
-                t1 = s1.getLatestRoot().getTree("/");
+                t1 = s1.getLatestRoot().getTreeOrNull("/");
                 assertSequence(
                         t1.getChildren(), "node1", "node2", "node3", "node4");
             } finally {
@@ -410,7 +410,7 @@ public class TreeTest {
         ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
-            Tree t1 = r1.getTree("/");
+            Tree t1 = r1.getTreeOrNull("/");
             t1.addChild("node1");
             t1.addChild("node2");
             t1.addChild("node3");
@@ -418,9 +418,9 @@ public class TreeTest {
             ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
-                Tree t2 = r2.getTree("/");
+                Tree t2 = r2.getTreeOrNull("/");
 
-                t1 = r1.getTree("/");
+                t1 = r1.getTreeOrNull("/");
                 // node4 from s1
                 t1.addChild("node4");
                 r1.commit();
@@ -430,7 +430,7 @@ public class TreeTest {
                 r2.commit();
 
                 r1 = s1.getLatestRoot();
-                t1 = r1.getTree("/");
+                t1 = r1.getTreeOrNull("/");
                 Set<String> names = Sets.newHashSet();
                 for (Tree t : t1.getChildren()) {
                     names.add(t.getName());
@@ -449,23 +449,23 @@ public class TreeTest {
         ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
-            Tree t1 = r1.getTree("/").addChild("c");
+            Tree t1 = r1.getTreeOrNull("/").addChild("c");
             t1.addChild("node1").orderBefore(null);
             t1.addChild("node2");
             r1.commit();
             ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
-                Tree t2 = r2.getTree("/c");
+                Tree t2 = r2.getTreeOrNull("/c");
 
-                t1 = r1.getTree("/c");
-                t1.getChild("node2").orderBefore("node1");
+                t1 = r1.getTreeOrNull("/c");
+                t1.getChildOrNull("node2").orderBefore("node1");
                 r1.commit();
                 assertSequence(t1.getChildren(), "node2", "node1");
 
                 t2.remove();
                 r2.commit();
-                assertFalse(r2.getTree("/").hasChild("c"));
+                assertFalse(r2.getTreeOrNull("/").hasChild("c"));
 
             } finally {
                 s2.close();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/UniquePropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/UniquePropertyTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/UniquePropertyTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/UniquePropertyTest.java Mon Apr 29 12:41:59 2013
@@ -41,12 +41,12 @@ public class UniquePropertyTest {
                 .with(new PropertyIndexEditorProvider())
                 .with(new InitialContent()).createRoot();
 
-        NodeUtil node = new NodeUtil(root.getTree("/"));
+        NodeUtil node = new NodeUtil(root.getTreeOrNull("/"));
         String uuid =  UUID.randomUUID().toString();
         node.setString(JcrConstants.JCR_UUID, uuid);
         root.commit();
 
-        NodeUtil child = new NodeUtil(root.getTree("/")).addChild("another", "rep:User");
+        NodeUtil child = new NodeUtil(root.getTreeOrNull("/")).addChild("another", "rep:User");
         child.setString(JcrConstants.JCR_UUID, uuid);
         try {
             root.commit();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerOursTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerOursTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerOursTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerOursTest.java Mon Apr 29 12:41:59 2013
@@ -52,7 +52,7 @@ public class DefaultConflictHandlerOursT
 
         // Add test content
         Root root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         tree.setProperty("a", 1);
         tree.setProperty("b", 2);
         tree.setProperty("c", 3);
@@ -73,96 +73,96 @@ public class DefaultConflictHandlerOursT
 
     @Test
     public void testAddExistingProperties() throws CommitFailedException {
-        theirRoot.getTree("/").setProperty("p", THEIR_VALUE);
-        theirRoot.getTree("/").setProperty("q", THEIR_VALUE);
-        ourRoot.getTree("/").setProperty("p", OUR_VALUE);
-        ourRoot.getTree("/").setProperty("q", OUR_VALUE);
+        theirRoot.getTreeOrNull("/").setProperty("p", THEIR_VALUE);
+        theirRoot.getTreeOrNull("/").setProperty("q", THEIR_VALUE);
+        ourRoot.getTreeOrNull("/").setProperty("p", OUR_VALUE);
+        ourRoot.getTreeOrNull("/").setProperty("q", OUR_VALUE);
 
         theirRoot.commit();
         ourRoot.commit();
 
-        PropertyState p = ourRoot.getTree("/").getProperty("p");
+        PropertyState p = ourRoot.getTreeOrNull("/").getProperty("p");
         assertNotNull(p);
         assertEquals(OUR_VALUE, p.getValue(STRING));
 
-        PropertyState q = ourRoot.getTree("/").getProperty("q");
+        PropertyState q = ourRoot.getTreeOrNull("/").getProperty("q");
         assertNotNull(q);
         assertEquals(OUR_VALUE, p.getValue(STRING));
     }
 
     @Test
     public void testChangeDeletedProperty() throws CommitFailedException {
-        theirRoot.getTree("/").removeProperty("a");
-        ourRoot.getTree("/").setProperty("a", OUR_VALUE);
+        theirRoot.getTreeOrNull("/").removeProperty("a");
+        ourRoot.getTreeOrNull("/").setProperty("a", OUR_VALUE);
 
         theirRoot.commit();
         ourRoot.commit();
 
-        PropertyState p = ourRoot.getTree("/").getProperty("a");
+        PropertyState p = ourRoot.getTreeOrNull("/").getProperty("a");
         assertNotNull(p);
         assertEquals(OUR_VALUE, p.getValue(STRING));
     }
 
     @Test
     public void testChangeChangedProperty() throws CommitFailedException {
-        theirRoot.getTree("/").setProperty("a", THEIR_VALUE);
-        ourRoot.getTree("/").setProperty("a", OUR_VALUE);
+        theirRoot.getTreeOrNull("/").setProperty("a", THEIR_VALUE);
+        ourRoot.getTreeOrNull("/").setProperty("a", OUR_VALUE);
 
         theirRoot.commit();
         ourRoot.commit();
 
-        PropertyState p = ourRoot.getTree("/").getProperty("a");
+        PropertyState p = ourRoot.getTreeOrNull("/").getProperty("a");
         assertNotNull(p);
         assertEquals(OUR_VALUE, p.getValue(STRING));
     }
 
     @Test
     public void testDeleteChangedProperty() throws CommitFailedException {
-        theirRoot.getTree("/").setProperty("a", THEIR_VALUE);
-        ourRoot.getTree("/").removeProperty("a");
+        theirRoot.getTreeOrNull("/").setProperty("a", THEIR_VALUE);
+        ourRoot.getTreeOrNull("/").removeProperty("a");
 
         theirRoot.commit();
         ourRoot.commit();
 
-        PropertyState p = ourRoot.getTree("/").getProperty("a");
+        PropertyState p = ourRoot.getTreeOrNull("/").getProperty("a");
         assertNull(p);
     }
 
     @Test
     public void testAddExistingNode() throws CommitFailedException {
-        theirRoot.getTree("/").addChild("n").setProperty("p", THEIR_VALUE);
-        ourRoot.getTree("/").addChild("n").setProperty("p", OUR_VALUE);
+        theirRoot.getTreeOrNull("/").addChild("n").setProperty("p", THEIR_VALUE);
+        ourRoot.getTreeOrNull("/").addChild("n").setProperty("p", OUR_VALUE);
 
         theirRoot.commit();
         ourRoot.commit();
 
-        Tree n = ourRoot.getTree("/n");
+        Tree n = ourRoot.getTreeOrNull("/n");
         assertNotNull(n);
         assertEquals(OUR_VALUE, n.getProperty("p").getValue(STRING));
     }
 
     @Test
     public void testChangeDeletedNode() throws CommitFailedException {
-        theirRoot.getTree("/x").remove();
-        ourRoot.getTree("/x").setProperty("p", OUR_VALUE);
+        theirRoot.getTreeOrNull("/x").remove();
+        ourRoot.getTreeOrNull("/x").setProperty("p", OUR_VALUE);
 
         theirRoot.commit();
         ourRoot.commit();
 
-        Tree n = ourRoot.getTree("/x");
+        Tree n = ourRoot.getTreeOrNull("/x");
         assertNotNull(n);
         assertEquals(OUR_VALUE, n.getProperty("p").getValue(STRING));
     }
 
     @Test
     public void testDeleteChangedNode() throws CommitFailedException {
-        theirRoot.getTree("/x").setProperty("p", THEIR_VALUE);
-        ourRoot.getTree("/x").remove();
+        theirRoot.getTreeOrNull("/x").setProperty("p", THEIR_VALUE);
+        ourRoot.getTreeOrNull("/x").remove();
 
         theirRoot.commit();
         ourRoot.commit();
 
-        Tree n = ourRoot.getTree("/x");
+        Tree n = ourRoot.getTreeOrNull("/x");
         assertNull(n);
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerTheirsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerTheirsTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerTheirsTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerTheirsTest.java Mon Apr 29 12:41:59 2013
@@ -52,7 +52,7 @@ public class DefaultConflictHandlerTheir
 
         // Add test content
         Root root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         tree.setProperty("a", 1);
         tree.setProperty("b", 2);
         tree.setProperty("c", 3);
@@ -73,95 +73,95 @@ public class DefaultConflictHandlerTheir
 
     @Test
     public void testAddExistingProperties() throws CommitFailedException {
-        theirRoot.getTree("/").setProperty("p", THEIR_VALUE);
-        theirRoot.getTree("/").setProperty("q", THEIR_VALUE);
-        ourRoot.getTree("/").setProperty("p", OUR_VALUE);
-        ourRoot.getTree("/").setProperty("q", OUR_VALUE);
+        theirRoot.getTreeOrNull("/").setProperty("p", THEIR_VALUE);
+        theirRoot.getTreeOrNull("/").setProperty("q", THEIR_VALUE);
+        ourRoot.getTreeOrNull("/").setProperty("p", OUR_VALUE);
+        ourRoot.getTreeOrNull("/").setProperty("q", OUR_VALUE);
 
         theirRoot.commit();
         ourRoot.commit();
 
-        PropertyState p = ourRoot.getTree("/").getProperty("p");
+        PropertyState p = ourRoot.getTreeOrNull("/").getProperty("p");
         assertNotNull(p);
         assertEquals(THEIR_VALUE, p.getValue(STRING));
 
-        PropertyState q = ourRoot.getTree("/").getProperty("q");
+        PropertyState q = ourRoot.getTreeOrNull("/").getProperty("q");
         assertNotNull(q);
         assertEquals(THEIR_VALUE, p.getValue(STRING));
     }
 
     @Test
     public void testChangeDeletedProperty() throws CommitFailedException {
-        theirRoot.getTree("/").removeProperty("a");
-        ourRoot.getTree("/").setProperty("a", OUR_VALUE);
+        theirRoot.getTreeOrNull("/").removeProperty("a");
+        ourRoot.getTreeOrNull("/").setProperty("a", OUR_VALUE);
 
         theirRoot.commit();
         ourRoot.commit();
 
-        PropertyState p = ourRoot.getTree("/").getProperty("a");
+        PropertyState p = ourRoot.getTreeOrNull("/").getProperty("a");
         assertNull(p);
     }
 
     @Test
     public void testChangeChangedProperty() throws CommitFailedException {
-        theirRoot.getTree("/").setProperty("a", THEIR_VALUE);
-        ourRoot.getTree("/").setProperty("a", OUR_VALUE);
+        theirRoot.getTreeOrNull("/").setProperty("a", THEIR_VALUE);
+        ourRoot.getTreeOrNull("/").setProperty("a", OUR_VALUE);
 
         theirRoot.commit();
         ourRoot.commit();
 
-        PropertyState p = ourRoot.getTree("/").getProperty("a");
+        PropertyState p = ourRoot.getTreeOrNull("/").getProperty("a");
         assertNotNull(p);
         assertEquals(THEIR_VALUE, p.getValue(STRING));
     }
 
     @Test
     public void testDeleteChangedProperty() throws CommitFailedException {
-        theirRoot.getTree("/").setProperty("a", THEIR_VALUE);
-        ourRoot.getTree("/").removeProperty("a");
+        theirRoot.getTreeOrNull("/").setProperty("a", THEIR_VALUE);
+        ourRoot.getTreeOrNull("/").removeProperty("a");
 
         theirRoot.commit();
         ourRoot.commit();
 
-        PropertyState p = ourRoot.getTree("/").getProperty("a");
+        PropertyState p = ourRoot.getTreeOrNull("/").getProperty("a");
         assertNotNull(p);
         assertEquals(THEIR_VALUE, p.getValue(STRING));
     }
 
     @Test
     public void testAddExistingNode() throws CommitFailedException {
-        theirRoot.getTree("/").addChild("n").setProperty("p", THEIR_VALUE);
-        ourRoot.getTree("/").addChild("n").setProperty("p", OUR_VALUE);
+        theirRoot.getTreeOrNull("/").addChild("n").setProperty("p", THEIR_VALUE);
+        ourRoot.getTreeOrNull("/").addChild("n").setProperty("p", OUR_VALUE);
 
         theirRoot.commit();
         ourRoot.commit();
 
-        Tree n = ourRoot.getTree("/n");
+        Tree n = ourRoot.getTreeOrNull("/n");
         assertNotNull(n);
         assertEquals(THEIR_VALUE, n.getProperty("p").getValue(STRING));
     }
 
     @Test
     public void testChangeDeletedNode() throws CommitFailedException {
-        theirRoot.getTree("/x").remove();
-        ourRoot.getTree("/x").setProperty("p", OUR_VALUE);
+        theirRoot.getTreeOrNull("/x").remove();
+        ourRoot.getTreeOrNull("/x").setProperty("p", OUR_VALUE);
 
         theirRoot.commit();
         ourRoot.commit();
 
-        Tree n = ourRoot.getTree("/x");
+        Tree n = ourRoot.getTreeOrNull("/x");
         assertNull(n);
     }
 
     @Test
     public void testDeleteChangedNode() throws CommitFailedException {
-        theirRoot.getTree("/x").setProperty("p", THEIR_VALUE);
-        ourRoot.getTree("/x").remove();
+        theirRoot.getTreeOrNull("/x").setProperty("p", THEIR_VALUE);
+        ourRoot.getTreeOrNull("/x").remove();
 
         theirRoot.commit();
         ourRoot.commit();
 
-        Tree n = ourRoot.getTree("/x");
+        Tree n = ourRoot.getTreeOrNull("/x");
         assertNotNull(n);
         assertEquals(THEIR_VALUE, n.getProperty("p").getValue(STRING));
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableRootTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableRootTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableRootTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableRootTest.java Mon Apr 29 12:41:59 2013
@@ -37,7 +37,7 @@ public class ImmutableRootTest extends O
 
         // Add test content
         Root root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         Tree x = tree.addChild("x");
         Tree y = x.addChild("y");
         Tree z = y.addChild("z");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableTreeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableTreeTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableTreeTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableTreeTest.java Mon Apr 29 12:41:59 2013
@@ -42,7 +42,7 @@ public class ImmutableTreeTest extends O
 
         // Add test content
         root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         Tree x = tree.addChild("x");
         Tree y = x.addChild("y");
         Tree z = y.addChild("z");
@@ -59,18 +59,18 @@ public class ImmutableTreeTest extends O
 
     @Test
     public void testGetPath() {
-        TreeImpl tree = (TreeImpl) root.getTree("/");
+        TreeImpl tree = (TreeImpl) root.getTreeOrNull("/");
 
         ImmutableTree immutable = new ImmutableTree(tree.getNodeState());
         assertEquals("/", immutable.getPath());
 
-        immutable = immutable.getChild("x");
+        immutable = immutable.getChildOrNull("x");
         assertEquals("/x", immutable.getPath());
 
-        immutable = immutable.getChild("y");
+        immutable = immutable.getChildOrNull("y");
         assertEquals("/x/y", immutable.getPath());
 
-        immutable = immutable.getChild("z");
+        immutable = immutable.getChildOrNull("z");
         assertEquals("/x/y/z", immutable.getPath());
     }
 
@@ -89,7 +89,7 @@ public class ImmutableTreeTest extends O
     public void testRoot() {
         ImmutableTree tree = ImmutableTree.createFromRoot(root, TreeTypeProvider.EMPTY);
         assertTrue(tree.isRoot());
-        assertNull(tree.getParent());
+        assertNull(tree.getParentOrNull());
         assertEquals("", tree.getName());
         assertEquals(TreeTypeProvider.TYPE_DEFAULT, tree.getType());
     }
@@ -97,15 +97,15 @@ public class ImmutableTreeTest extends O
     @Test
     public void testGetParent() {
         ImmutableTree tree = ImmutableTree.createFromRoot(root, TreeTypeProvider.EMPTY);
-        assertNull(tree.getParent());
+        assertNull(tree.getParentOrNull());
 
-        ImmutableTree child = tree.getChild("x");
-        assertNotNull(child.getParent());
-        assertEquals("/", child.getParent().getPath());
+        ImmutableTree child = tree.getChildOrNull("x");
+        assertNotNull(child.getParentOrNull());
+        assertEquals("/", child.getParentOrNull().getPath());
 
         ImmutableTree disconnected = new ImmutableTree(ImmutableTree.ParentProvider.UNSUPPORTED, child.getName(), child.getNodeState(), TreeTypeProvider.EMPTY);
         try {
-            disconnected.getParent();
+            disconnected.getParentOrNull();
         } catch (UnsupportedOperationException e) {
             // success
         }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/LargeMoveTestIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/LargeMoveTestIT.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/LargeMoveTestIT.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/LargeMoveTestIT.java Mon Apr 29 12:41:59 2013
@@ -44,7 +44,7 @@ public class LargeMoveTestIT extends Oak
         // Add test content
         Root root = session.getLatestRoot();
 
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         Tree treeA = tree.addChild("tree-a");
         this.treeAPath = treeA.getPath();
         Tree treeB = tree.addChild("tree-b");
@@ -69,7 +69,7 @@ public class LargeMoveTestIT extends Oak
 
         // Concurrent changes to trunk: enforce rebase
         Root root2 = session.getLatestRoot();
-        root2.getTree("/").addChild("any");
+        root2.getTreeOrNull("/").addChild("any");
         root2.commit();
 
         root1.move(treeAPath, PathUtils.concat(treeBPath, "tree-a-moved"));

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java Mon Apr 29 12:41:59 2013
@@ -87,10 +87,10 @@ public class RootImplFuzzIT {
             log.info("{}", op);
             op.apply(root1);
             op.apply(root2);
-            checkEqual(root1.getTree("/"), root2.getTree("/"));
+            checkEqual(root1.getTreeOrNull("/"), root2.getTreeOrNull("/"));
 
             root1.commit();
-            checkEqual(root1.getTree("/"), root2.getTree("/"));
+            checkEqual(root1.getTreeOrNull("/"), root2.getTreeOrNull("/"));
             if (op instanceof Save) {
                 root2.commit();
                 assertEquals("seed " + SEED, store1.getRoot(), store2.getRoot());
@@ -138,7 +138,7 @@ public class RootImplFuzzIT {
 
             @Override
             void apply(RootImpl root) {
-                root.getTree(parentPath).addChild(name);
+                root.getTreeOrNull(parentPath).addChild(name);
             }
 
             @Override
@@ -158,7 +158,7 @@ public class RootImplFuzzIT {
             void apply(RootImpl root) {
                 String parentPath = PathUtils.getParentPath(path);
                 String name = PathUtils.getName(path);
-                root.getTree(parentPath).getChild(name).remove();
+                root.getTreeOrNull(parentPath).getChildOrNull(name).remove();
             }
 
             @Override
@@ -220,7 +220,7 @@ public class RootImplFuzzIT {
 
             @Override
             void apply(RootImpl root) {
-                root.getTree(parentPath).setProperty(propertyName, propertyValue);
+                root.getTreeOrNull(parentPath).setProperty(propertyName, propertyValue);
             }
 
             @Override
@@ -241,7 +241,7 @@ public class RootImplFuzzIT {
 
             @Override
             void apply(RootImpl root) {
-                root.getTree(parentPath).removeProperty(name);
+                root.getTreeOrNull(parentPath).removeProperty(name);
             }
 
             @Override
@@ -393,7 +393,7 @@ public class RootImplFuzzIT {
     }
 
     private String chooseNode(String parentPath) {
-        Tree state = root1.getTree(parentPath);
+        Tree state = root1.getTreeOrNull(parentPath);
 
         int k = random.nextInt((int) (state.getChildrenCount() + 1));
         int c = 0;
@@ -407,7 +407,7 @@ public class RootImplFuzzIT {
     }
 
     private String chooseProperty(String parentPath) {
-        Tree state = root1.getTree(parentPath);
+        Tree state = root1.getTreeOrNull(parentPath);
         int k = random.nextInt((int) (state.getPropertyCount() + 1));
         int c = 0;
         for (PropertyState entry : state.getProperties()) {
@@ -436,7 +436,7 @@ public class RootImplFuzzIT {
         }
 
         for (Tree child1 : tree1.getChildren()) {
-            checkEqual(child1, tree2.getChild(child1.getName()));
+            checkEqual(child1, tree2.getChildOrNull(child1.getName()));
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java Mon Apr 29 12:41:59 2013
@@ -49,7 +49,7 @@ public class RootImplTest extends OakBas
 
         // Add test content
         Root root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         tree.setProperty("a", 1);
         tree.setProperty("b", 2);
         tree.setProperty("c", 3);
@@ -78,7 +78,7 @@ public class RootImplTest extends OakBas
         validPaths.add("/z");
 
         for (String treePath : validPaths) {
-            Tree tree = root.getTree(treePath);
+            Tree tree = root.getTreeOrNull(treePath);
             assertNotNull(tree);
             assertEquals(treePath, tree.getPath());
         }
@@ -88,17 +88,17 @@ public class RootImplTest extends OakBas
         invalidPaths.add("/x/any");
 
         for (String treePath : invalidPaths) {
-            assertNull(root.getTree(treePath));
+            assertNull(root.getTreeOrNull(treePath));
         }
     }
 
     @Test
     public void move() throws CommitFailedException {
         Root root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
-        Tree y = tree.getChild("y");
-        Tree x = tree.getChild("x");
+        Tree y = tree.getChildOrNull("y");
+        Tree x = tree.getChildOrNull("x");
         assertNotNull(x);
 
         root.move("/x", "/y/xx");
@@ -110,26 +110,26 @@ public class RootImplTest extends OakBas
 
         assertFalse(tree.hasChild("x"));
         assertTrue(tree.hasChild("y"));
-        assertTrue(tree.getChild("y").hasChild("xx"));
+        assertTrue(tree.getChildOrNull("y").hasChild("xx"));
     }
 
     @Test
     public void moveRemoveAdd() {
         Root root = session.getLatestRoot();
 
-        Tree x = root.getTree("/x");
-        Tree z = root.getTree("/z");
+        Tree x = root.getTreeOrNull("/x");
+        Tree z = root.getTreeOrNull("/z");
         z.setProperty("p", "1");
 
         root.move("/z", "/x/z");
-        root.getTree("/x/z").remove();
+        root.getTreeOrNull("/x/z").remove();
 
         assertFalse(z.exists());
 
         x.addChild("z");
         assertEquals(Status.EXISTING, z.getStatus());
 
-        x.getChild("z").setProperty("p", "2");
+        x.getChildOrNull("z").setProperty("p", "2");
         PropertyState p = z.getProperty("p");
         assertNotNull(p);
         assertEquals("2", p.getValue(Type.STRING));
@@ -138,24 +138,24 @@ public class RootImplTest extends OakBas
     @Test
     public void moveNew() {
         Root root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         Tree t = tree.addChild("new");
 
         root.move("/new", "/y/new");
         assertEquals("/y/new", t.getPath());
 
-        assertNull(tree.getChild("new"));
+        assertNull(tree.getChildOrNull("new"));
     }
 
     @Test
     public void moveExistingParent() throws CommitFailedException {
         Root root = session.getLatestRoot();
-        root.getTree("/").addChild("parent").addChild("new");
+        root.getTreeOrNull("/").addChild("parent").addChild("new");
         root.commit();
 
-        Tree parent = root.getTree("/parent");
-        Tree n = root.getTree("/parent/new");
+        Tree parent = root.getTreeOrNull("/parent");
+        Tree n = root.getTreeOrNull("/parent/new");
 
         root.move("/parent", "/moved");
 
@@ -172,7 +172,7 @@ public class RootImplTest extends OakBas
     @Test
     public void removeMoved() throws CommitFailedException {
         Root root = session.getLatestRoot();
-        Tree r = root.getTree("/");
+        Tree r = root.getTreeOrNull("/");
         r.addChild("a");
         r.addChild("b");
 
@@ -180,7 +180,7 @@ public class RootImplTest extends OakBas
         assertFalse(r.hasChild("a"));
         assertTrue(r.hasChild("b"));
 
-        r.getChild("b").remove();
+        r.getChildOrNull("b").remove();
         assertFalse(r.hasChild("a"));
         assertFalse(r.hasChild("b"));
 
@@ -192,8 +192,8 @@ public class RootImplTest extends OakBas
     @Test
     public void rename() throws CommitFailedException {
         Root root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
-        Tree x = tree.getChild("x");
+        Tree tree = root.getTreeOrNull("/");
+        Tree x = tree.getChildOrNull("x");
         assertNotNull(x);
 
         root.move("/x", "/xx");
@@ -210,10 +210,10 @@ public class RootImplTest extends OakBas
     @Test
     public void copy() throws CommitFailedException {
         Root root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
-        Tree y = tree.getChild("y");
-        Tree x = tree.getChild("x");
+        Tree y = tree.getChildOrNull("y");
+        Tree x = tree.getChildOrNull("x");
         assertNotNull(x);
 
         assertTrue(tree.hasChild("x"));
@@ -225,30 +225,30 @@ public class RootImplTest extends OakBas
 
         assertTrue(tree.hasChild("x"));
         assertTrue(tree.hasChild("y"));
-        assertTrue(tree.getChild("y").hasChild("xx"));
+        assertTrue(tree.getChildOrNull("y").hasChild("xx"));
     }
 
     @Test
     public void deepCopy() throws CommitFailedException {
         Root root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
-        Tree y = tree.getChild("y");
+        Tree y = tree.getChildOrNull("y");
 
-        root.getTree("/x").addChild("x1");
+        root.getTreeOrNull("/x").addChild("x1");
         root.copy("/x", "/y/xx");
         assertTrue(y.hasChild("xx"));
-        assertTrue(y.getChild("xx").hasChild("x1"));
+        assertTrue(y.getChildOrNull("xx").hasChild("x1"));
 
         root.commit();
 
         assertTrue(tree.hasChild("x"));
         assertTrue(tree.hasChild("y"));
-        assertTrue(tree.getChild("y").hasChild("xx"));
-        assertTrue(tree.getChild("y").getChild("xx").hasChild("x1"));
+        assertTrue(tree.getChildOrNull("y").hasChild("xx"));
+        assertTrue(tree.getChildOrNull("y").getChildOrNull("xx").hasChild("x1"));
 
-        Tree x = tree.getChild("x");
-        Tree xx = tree.getChild("y").getChild("xx");
+        Tree x = tree.getChildOrNull("x");
+        Tree xx = tree.getChildOrNull("y").getChildOrNull("xx");
         checkEqual(x, xx);
     }
 
@@ -257,22 +257,22 @@ public class RootImplTest extends OakBas
         Root root1 = session.getLatestRoot();
         Root root2 = session.getLatestRoot();
 
-        checkEqual(root1.getTree("/"), root2.getTree("/"));
+        checkEqual(root1.getTreeOrNull("/"), root2.getTreeOrNull("/"));
 
-        root2.getTree("/").addChild("one").addChild("two").addChild("three")
+        root2.getTreeOrNull("/").addChild("one").addChild("two").addChild("three")
                 .setProperty("p1", "V1");
         root2.commit();
 
         root1.rebase();
-        checkEqual(root1.getTree("/"), (root2.getTree("/")));
+        checkEqual(root1.getTreeOrNull("/"), (root2.getTreeOrNull("/")));
 
-        Tree one = root2.getTree("/one");
-        one.getChild("two").remove();
+        Tree one = root2.getTreeOrNull("/one");
+        one.getChildOrNull("two").remove();
         one.addChild("four");
         root2.commit();
 
         root1.rebase();
-        checkEqual(root1.getTree("/"), (root2.getTree("/")));
+        checkEqual(root1.getTreeOrNull("/"), (root2.getTreeOrNull("/")));
     }
 
     @Test
@@ -280,17 +280,17 @@ public class RootImplTest extends OakBas
         Root root1 = session.getLatestRoot();
         Root root2 = session.getLatestRoot();
 
-        checkEqual(root1.getTree("/"), root2.getTree("/"));
+        checkEqual(root1.getTreeOrNull("/"), root2.getTreeOrNull("/"));
 
-        root2.getTree("/").addChild("one").addChild("two").addChild("three")
+        root2.getTreeOrNull("/").addChild("one").addChild("two").addChild("three")
                 .setProperty("p1", "V1");
         root2.commit();
 
-        root1.getTree("/").addChild("child");
+        root1.getTreeOrNull("/").addChild("child");
         root1.rebase();
 
-        root2.getTree("/").addChild("child");
-        checkEqual(root1.getTree("/"), (root2.getTree("/")));
+        root2.getTreeOrNull("/").addChild("child");
+        checkEqual(root1.getTreeOrNull("/"), (root2.getTreeOrNull("/")));
     }
 
     @Test
@@ -298,17 +298,17 @@ public class RootImplTest extends OakBas
         Root root1 = session.getLatestRoot();
         Root root2 = session.getLatestRoot();
 
-        checkEqual(root1.getTree("/"), root2.getTree("/"));
+        checkEqual(root1.getTreeOrNull("/"), root2.getTreeOrNull("/"));
 
-        root2.getTree("/").addChild("one").addChild("two").addChild("three")
+        root2.getTreeOrNull("/").addChild("one").addChild("two").addChild("three")
                 .setProperty("p1", "V1");
         root2.commit();
 
-        root1.getTree("/").getChild("x").remove();
+        root1.getTreeOrNull("/").getChildOrNull("x").remove();
         root1.rebase();
 
-        root2.getTree("/").getChild("x").remove();
-        checkEqual(root1.getTree("/"), (root2.getTree("/")));
+        root2.getTreeOrNull("/").getChildOrNull("x").remove();
+        checkEqual(root1.getTreeOrNull("/"), (root2.getTreeOrNull("/")));
     }
 
     @Test
@@ -316,17 +316,17 @@ public class RootImplTest extends OakBas
         Root root1 = session.getLatestRoot();
         Root root2 = session.getLatestRoot();
 
-        checkEqual(root1.getTree("/"), root2.getTree("/"));
+        checkEqual(root1.getTreeOrNull("/"), root2.getTreeOrNull("/"));
 
-        root2.getTree("/").addChild("one").addChild("two").addChild("three")
+        root2.getTreeOrNull("/").addChild("one").addChild("two").addChild("three")
                 .setProperty("p1", "V1");
         root2.commit();
 
-        root1.getTree("/").setProperty("new", 42);
+        root1.getTreeOrNull("/").setProperty("new", 42);
         root1.rebase();
 
-        root2.getTree("/").setProperty("new", 42);
-        checkEqual(root1.getTree("/"), (root2.getTree("/")));
+        root2.getTreeOrNull("/").setProperty("new", 42);
+        checkEqual(root1.getTreeOrNull("/"), (root2.getTreeOrNull("/")));
     }
 
     @Test
@@ -334,17 +334,17 @@ public class RootImplTest extends OakBas
         Root root1 = session.getLatestRoot();
         Root root2 = session.getLatestRoot();
 
-        checkEqual(root1.getTree("/"), root2.getTree("/"));
+        checkEqual(root1.getTreeOrNull("/"), root2.getTreeOrNull("/"));
 
-        root2.getTree("/").addChild("one").addChild("two").addChild("three")
+        root2.getTreeOrNull("/").addChild("one").addChild("two").addChild("three")
                 .setProperty("p1", "V1");
         root2.commit();
 
-        root1.getTree("/").removeProperty("a");
+        root1.getTreeOrNull("/").removeProperty("a");
         root1.rebase();
 
-        root2.getTree("/").removeProperty("a");
-        checkEqual(root1.getTree("/"), (root2.getTree("/")));
+        root2.getTreeOrNull("/").removeProperty("a");
+        checkEqual(root1.getTreeOrNull("/"), (root2.getTreeOrNull("/")));
     }
 
     @Test
@@ -352,17 +352,17 @@ public class RootImplTest extends OakBas
         Root root1 = session.getLatestRoot();
         Root root2 = session.getLatestRoot();
 
-        checkEqual(root1.getTree("/"), root2.getTree("/"));
+        checkEqual(root1.getTreeOrNull("/"), root2.getTreeOrNull("/"));
 
-        root2.getTree("/").addChild("one").addChild("two").addChild("three")
+        root2.getTreeOrNull("/").addChild("one").addChild("two").addChild("three")
                 .setProperty("p1", "V1");
         root2.commit();
 
-        root1.getTree("/").setProperty("a", 42);
+        root1.getTreeOrNull("/").setProperty("a", 42);
         root1.rebase();
 
-        root2.getTree("/").setProperty("a", 42);
-        checkEqual(root1.getTree("/"), (root2.getTree("/")));
+        root2.getTreeOrNull("/").setProperty("a", 42);
+        checkEqual(root1.getTreeOrNull("/"), (root2.getTreeOrNull("/")));
     }
 
     @Test
@@ -370,9 +370,9 @@ public class RootImplTest extends OakBas
         Root root1 = session.getLatestRoot();
         Root root2 = session.getLatestRoot();
 
-        checkEqual(root1.getTree("/"), root2.getTree("/"));
+        checkEqual(root1.getTreeOrNull("/"), root2.getTreeOrNull("/"));
 
-        root2.getTree("/").addChild("one").addChild("two").addChild("three")
+        root2.getTreeOrNull("/").addChild("one").addChild("two").addChild("three")
                 .setProperty("p1", "V1");
         root2.commit();
 
@@ -380,7 +380,7 @@ public class RootImplTest extends OakBas
         root1.rebase();
 
         root2.move("/x", "/y/x-moved");
-        checkEqual(root1.getTree("/"), (root2.getTree("/")));
+        checkEqual(root1.getTreeOrNull("/"), (root2.getTreeOrNull("/")));
     }
 
     @Test
@@ -388,9 +388,9 @@ public class RootImplTest extends OakBas
         Root root1 = session.getLatestRoot();
         Root root2 = session.getLatestRoot();
 
-        checkEqual(root1.getTree("/"), root2.getTree("/"));
+        checkEqual(root1.getTreeOrNull("/"), root2.getTreeOrNull("/"));
 
-        root2.getTree("/").addChild("one").addChild("two").addChild("three")
+        root2.getTreeOrNull("/").addChild("one").addChild("two").addChild("three")
                 .setProperty("p1", "V1");
         root2.commit();
 
@@ -398,7 +398,7 @@ public class RootImplTest extends OakBas
         root1.rebase();
 
         root2.copy("/x", "/y/x-copied");
-        checkEqual(root1.getTree("/"), (root2.getTree("/")));
+        checkEqual(root1.getTreeOrNull("/"), (root2.getTreeOrNull("/")));
     }
 
     private static void checkEqual(Tree tree1, Tree tree2) {
@@ -410,7 +410,7 @@ public class RootImplTest extends OakBas
         }
 
         for (Tree child1 : tree1.getChildren()) {
-            checkEqual(child1, tree2.getChild(child1.getName()));
+            checkEqual(child1, tree2.getChildOrNull(child1.getName()));
         }
     }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java Mon Apr 29 12:41:59 2013
@@ -54,7 +54,7 @@ public class TreeImplTest extends OakBas
 
         // Add test content
         root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         tree.setProperty("a", 1);
         tree.setProperty("b", 2);
         tree.setProperty("c", 3);
@@ -74,18 +74,18 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void getChild() {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
-        Tree child = tree.getChild("any");
+        Tree child = tree.getChildOrNull("any");
         assertNull(child);
 
-        child = tree.getChild("x");
+        child = tree.getChildOrNull("x");
         assertNotNull(child);
     }
 
     @Test
     public void getProperty() {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         PropertyState propertyState = tree.getProperty("any");
         assertNull(propertyState);
@@ -99,7 +99,7 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void getChildren() {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         Iterable<Tree> children = tree.getChildren();
 
@@ -116,7 +116,7 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void getProperties() {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         Set<PropertyState> expectedProperties = Sets.newHashSet(
                 LongPropertyState.createLongProperty("a", 1L),
@@ -134,7 +134,7 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void addChild() throws CommitFailedException {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         assertFalse(tree.hasChild("new"));
         Tree added = tree.addChild("new");
@@ -146,13 +146,13 @@ public class TreeImplTest extends OakBas
 
         assertTrue(tree.hasChild("new"));
 
-        tree.getChild("new").addChild("more");
-        assertTrue(tree.getChild("new").hasChild("more"));
+        tree.getChildOrNull("new").addChild("more");
+        assertTrue(tree.getChildOrNull("new").hasChild("more"));
     }
 
     @Test
     public void addExistingChild() throws CommitFailedException {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         assertFalse(tree.hasChild("new"));
         tree.addChild("new");
@@ -167,10 +167,10 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void removeChild() throws CommitFailedException {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         assertTrue(tree.hasChild("x"));
-        tree.getChild("x").remove();
+        tree.getChildOrNull("x").remove();
         assertFalse(tree.hasChild("x"));
 
         root.commit();
@@ -180,19 +180,19 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void removeNew() {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         Tree t = tree.addChild("new");
 
-        tree.getChild("new").remove();
+        tree.getChildOrNull("new").remove();
         assertFalse(t.exists());
 
-        assertNull(tree.getChild("new"));
+        assertNull(tree.getChildOrNull("new"));
     }
 
     @Test
     public void setProperty() throws CommitFailedException {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         assertFalse(tree.hasProperty("new"));
         tree.setProperty("new", "value");
@@ -211,7 +211,7 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void removeProperty() throws CommitFailedException {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         assertTrue(tree.hasProperty("a"));
         tree.removeProperty("a");
@@ -224,11 +224,11 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void getChildrenCount() {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         assertEquals(3, tree.getChildrenCount());
 
-        tree.getChild("x").remove();
+        tree.getChildOrNull("x").remove();
         assertEquals(2, tree.getChildrenCount());
 
         tree.addChild("a");
@@ -240,7 +240,7 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void getPropertyCount() {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         assertEquals(3, tree.getPropertyCount());
 
@@ -259,7 +259,7 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void addAndRemoveProperty() throws CommitFailedException {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         tree.setProperty("P0", "V1");
         root.commit();
@@ -274,27 +274,27 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void nodeStatus() throws CommitFailedException {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         tree.addChild("new");
-        assertEquals(Tree.Status.NEW, tree.getChild("new").getStatus());
+        assertEquals(Tree.Status.NEW, tree.getChildOrNull("new").getStatus());
         root.commit();
 
-        assertEquals(Tree.Status.EXISTING, tree.getChild("new").getStatus());
-        Tree added = tree.getChild("new");
+        assertEquals(Tree.Status.EXISTING, tree.getChildOrNull("new").getStatus());
+        Tree added = tree.getChildOrNull("new");
         added.addChild("another");
-        assertEquals(Tree.Status.MODIFIED, tree.getChild("new").getStatus());
+        assertEquals(Tree.Status.MODIFIED, tree.getChildOrNull("new").getStatus());
         root.commit();
 
-        assertEquals(Tree.Status.EXISTING, tree.getChild("new").getStatus());
-        tree.getChild("new").getChild("another").remove();
-        assertEquals(Tree.Status.MODIFIED, tree.getChild("new").getStatus());
+        assertEquals(Tree.Status.EXISTING, tree.getChildOrNull("new").getStatus());
+        tree.getChildOrNull("new").getChildOrNull("another").remove();
+        assertEquals(Tree.Status.MODIFIED, tree.getChildOrNull("new").getStatus());
         root.commit();
 
-        assertEquals(Tree.Status.EXISTING, tree.getChild("new").getStatus());
-        assertNull(tree.getChild("new").getChild("another"));
+        assertEquals(Tree.Status.EXISTING, tree.getChildOrNull("new").getStatus());
+        assertNull(tree.getChildOrNull("new").getChildOrNull("another"));
 
-        Tree x = root.getTree("/x");
+        Tree x = root.getTreeOrNull("/x");
         Tree y = x.addChild("y");
         x.remove();
 
@@ -304,7 +304,7 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void propertyStatus() throws CommitFailedException {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
 
         tree.setProperty("new", "value1");
         assertEquals(Tree.Status.NEW, tree.getPropertyStatus("new"));
@@ -322,25 +322,25 @@ public class TreeImplTest extends OakBas
 
         assertNull(tree.getPropertyStatus("new"));
 
-        Tree x = root.getTree("/x");
+        Tree x = root.getTreeOrNull("/x");
         x.setProperty("y", "value1");
         x.remove();
     }
 
     @Test
     public void noTransitiveModifiedStatus() throws CommitFailedException {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         tree.addChild("one").addChild("two");
         root.commit();
 
-        tree.getChild("one").getChild("two").addChild("three");
-        assertEquals(Tree.Status.EXISTING, tree.getChild("one").getStatus());
-        assertEquals(Tree.Status.MODIFIED, tree.getChild("one").getChild("two").getStatus());
+        tree.getChildOrNull("one").getChildOrNull("two").addChild("three");
+        assertEquals(Tree.Status.EXISTING, tree.getChildOrNull("one").getStatus());
+        assertEquals(Tree.Status.MODIFIED, tree.getChildOrNull("one").getChildOrNull("two").getStatus());
     }
 
     @Test
     public void largeChildList() throws CommitFailedException {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         Set<String> added = new HashSet<String>();
 
         Tree large = tree.addChild("large");
@@ -361,7 +361,7 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void testSetOrderableChildrenSetsProperty() throws Exception {
-        Tree tree = root.getTree("/").addChild("test");
+        Tree tree = root.getTreeOrNull("/").addChild("test");
         tree.setOrderableChildren(true);
         assertTrue(((TreeImpl) tree).getNodeState().hasProperty(TreeImpl.OAK_CHILD_ORDER));
 
@@ -381,7 +381,7 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void testSetOrderableChildren() throws Exception {
-        Tree tree = root.getTree("/").addChild("test2");
+        Tree tree = root.getTreeOrNull("/").addChild("test2");
         tree.setOrderableChildren(true);
 
         String[] childNames = new String[]{"a", "b", "c", "d"};
@@ -397,7 +397,7 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void testDisconnectAfterRefresh() {
-        Tree x = root.getTree("/x");
+        Tree x = root.getTreeOrNull("/x");
         x.setProperty("p", "any");
         Tree xx = x.addChild("xx");
         xx.setProperty("q", "any");
@@ -416,7 +416,7 @@ public class TreeImplTest extends OakBas
 
     @Test
     public void testDisconnectAfterRemove() {
-        Tree x = root.getTree("/x");
+        Tree x = root.getTreeOrNull("/x");
         x.setProperty("p", "any");
         Tree xx = x.addChild("xx");
         xx.setProperty("q", "any");
@@ -426,7 +426,7 @@ public class TreeImplTest extends OakBas
         assertEquals(Status.NEW, xx.getStatus());
         assertEquals(Status.NEW, xx.getPropertyStatus("q"));
 
-        root.getTree("/x").remove();
+        root.getTreeOrNull("/x").remove();
 
         assertFalse(x.exists());
         assertFalse(xx.exists());

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeLocationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeLocationTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeLocationTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeLocationTest.java Mon Apr 29 12:41:59 2013
@@ -44,7 +44,7 @@ public class TreeLocationTest extends Oa
 
         // Add test content
         root = session.getLatestRoot();
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         tree.setProperty("a", 1);
         tree.setProperty("b", 2);
         tree.setProperty("c", 3);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagerTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagerTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagerTest.java Mon Apr 29 12:41:59 2013
@@ -59,7 +59,7 @@ public class IdentifierManagerTest {
             .with(new InitialContent())
             .createContentSession().getLatestRoot();
 
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         Tree x = tree.addChild("x");
         Tree y = tree.addChild("y");
         y.setProperty(JcrConstants.JCR_UUID, UUID_Y);
@@ -74,16 +74,16 @@ public class IdentifierManagerTest {
 
     @Test
     public void getIdentifierTest() {
-        Tree rootTree = root.getTree("/");
+        Tree rootTree = root.getTreeOrNull("/");
         assertEquals(ID_ROOT, identifierManager.getIdentifier(rootTree));
 
-        Tree xx1 = root.getTree(PATH_X1);
+        Tree xx1 = root.getTreeOrNull(PATH_X1);
         assertEquals(ID_X1, identifierManager.getIdentifier(xx1));
 
-        Tree yy1 = root.getTree(PATH_Y1);
+        Tree yy1 = root.getTreeOrNull(PATH_Y1);
         assertEquals(ID_Y1, identifierManager.getIdentifier(yy1));
 
-        Tree zz1 = root.getTree(PATH_Z1);
+        Tree zz1 = root.getTreeOrNull(PATH_Z1);
         assertEquals(ID_Z1, identifierManager.getIdentifier(zz1));
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java Mon Apr 29 12:41:59 2013
@@ -24,8 +24,6 @@ import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.plugins.index.IndexUtils;
-import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider;
-import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexProvider;
 import org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent;
 import org.apache.jackrabbit.oak.query.AbstractQueryTest;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
@@ -65,7 +63,7 @@ public class RelativePathTest extends Ab
 
     @Test
     public void query() throws Exception {
-        Tree t = root.getTree("/");
+        Tree t = root.getTreeOrNull("/");
         t.addChild("a").addChild("n").setProperty("myProp", "foo");
         t.addChild("b").addChild("n").setProperty("myProp", "bar");
         t.addChild("c").addChild("x").setProperty("myProp", "foo");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java Mon Apr 29 12:41:59 2013
@@ -34,7 +34,7 @@ public class ReadWriteNamespaceRegistryT
         NamespaceRegistry r = new ReadWriteNamespaceRegistry() {
             @Override
             protected Tree getReadTree() {
-                return session.getLatestRoot().getTree("/");
+                return session.getLatestRoot().getTreeOrNull("/");
             }
             @Override
             protected Root getWriteRoot() {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java Mon Apr 29 12:41:59 2013
@@ -80,7 +80,7 @@ public abstract class AbstractQueryTest 
      * {@link #createTestIndexNode(Tree, String)} for a helper method
      */
     protected void createTestIndexNode() throws Exception {
-        Tree index = root.getTree("/");
+        Tree index = root.getTreeOrNull("/");
         createTestIndexNode(index, "unknown");
         root.commit();
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java Mon Apr 29 12:41:59 2013
@@ -68,7 +68,7 @@ public class JsopUtil {
             throws UnsupportedOperationException {
         int index = commit.indexOf(' ');
         String path = commit.substring(0, index).trim();
-        Tree c = root.getTree(path);
+        Tree c = root.getTreeOrNull(path);
         if (c == null) {
             // TODO create intermediary?
             throw new UnsupportedOperationException("Non existing path " + path);
@@ -92,7 +92,7 @@ public class JsopUtil {
             if (!t.hasChild(p)) {
                 return;
             }
-            t = t.getChild(p);
+            t = t.getChildOrNull(p);
         }
         t.remove();
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java Mon Apr 29 12:41:59 2013
@@ -140,8 +140,8 @@ public class TokenProviderImplTest exten
 
         TokenInfo info = tokenProvider.createToken(userId, attributes);
 
-        Tree userTree = root.getTree(getUserManager().getAuthorizable(userId).getPath());
-        Tree tokens = userTree.getChild(".tokens");
+        Tree userTree = root.getTreeOrNull(getUserManager().getAuthorizable(userId).getPath());
+        Tree tokens = userTree.getChildOrNull(".tokens");
         assertNotNull(tokens);
         assertEquals(1, tokens.getChildrenCount());
 
@@ -211,12 +211,12 @@ public class TokenProviderImplTest exten
     public void testRemoveTokenRemovesNode() throws Exception {
         TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap());
 
-        Tree userTree = root.getTree(getUserManager().getAuthorizable(userId).getPath());
-        Tree tokens = userTree.getChild(".tokens");
+        Tree userTree = root.getTreeOrNull(getUserManager().getAuthorizable(userId).getPath());
+        Tree tokens = userTree.getChildOrNull(".tokens");
         String tokenNodePath = tokens.getChildren().iterator().next().getPath();
 
         tokenProvider.removeToken(info);
-        assertNull(root.getTree(tokenNodePath));
+        assertNull(root.getTreeOrNull(tokenNodePath));
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java Mon Apr 29 12:41:59 2013
@@ -85,7 +85,7 @@ public class LoginModuleImplTest extends
         // verify initial user-content looks like expected
         Authorizable anonymous = userMgr.getAuthorizable(anonymousID);
         assertNotNull(anonymous);
-        assertFalse(root.getTree(anonymous.getPath()).hasProperty(UserConstants.REP_PASSWORD));
+        assertFalse(root.getTreeOrNull(anonymous.getPath()).hasProperty(UserConstants.REP_PASSWORD));
 
         ContentSession cs = null;
         try {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImplTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImplTest.java Mon Apr 29 12:41:59 2013
@@ -105,13 +105,13 @@ public class AccessControlManagerImplTes
         super.before();
 
         registerNamespace(TestNameMapper.TEST_PREFIX, TestNameMapper.TEST_URI);
-        nameMapper = new TestNameMapper(Namespaces.getNamespaceMap(root.getTree("/")));
+        nameMapper = new TestNameMapper(Namespaces.getNamespaceMap(root.getTreeOrNull("/")));
         npMapper = new NamePathMapperImpl(nameMapper);
 
         acMgr = getAccessControlManager(npMapper);
         valueFactory = new ValueFactoryImpl(root.getBlobFactory(), npMapper);
 
-        NodeUtil rootNode = new NodeUtil(root.getTree("/"), npMapper);
+        NodeUtil rootNode = new NodeUtil(root.getTreeOrNull("/"), npMapper);
         rootNode.addChild(testName, JcrConstants.NT_UNSTRUCTURED);
         root.commit();
 
@@ -123,7 +123,7 @@ public class AccessControlManagerImplTes
     public void after() throws Exception {
         try {
             root.refresh();
-            root.getTree(testPath).remove();
+            root.getTreeOrNull(testPath).remove();
             root.commit();
 
             if (testRoot != null) {
@@ -228,7 +228,7 @@ public class AccessControlManagerImplTes
         acMgr.setPolicy(testPath, policy);
 
         String aclPath = testPath + '/' + REP_POLICY;
-        Tree acl = root.getTree(aclPath);
+        Tree acl = root.getTreeOrNull(aclPath);
         assertNotNull(acl);
         Iterator<Tree> aces = acl.getChildren().iterator();
         assertTrue(aces.hasNext());
@@ -239,7 +239,7 @@ public class AccessControlManagerImplTes
         acContentPath.add(aclPath);
         acContentPath.add(ace.getPath());
 
-        Tree rest = ace.getChild(REP_RESTRICTIONS);
+        Tree rest = ace.getChildOrNull(REP_RESTRICTIONS);
         if (rest != null) {
             acContentPath.add(rest.getPath());
         }
@@ -718,7 +718,7 @@ public class AccessControlManagerImplTes
 
     @Test
     public void testGetApplicablePoliciesOnAccessControllable() throws Exception {
-        NodeUtil node = new NodeUtil(root.getTree(testPath));
+        NodeUtil node = new NodeUtil(root.getTreeOrNull(testPath));
         node.setNames(JcrConstants.JCR_MIXINTYPES, MIX_REP_ACCESS_CONTROLLABLE);
 
         AccessControlPolicyIterator itr = acMgr.getApplicablePolicies(testPath);
@@ -747,7 +747,7 @@ public class AccessControlManagerImplTes
 
     @Test
     public void testGetApplicablePoliciesWithCollidingNode() throws Exception {
-        NodeUtil testTree = new NodeUtil(root.getTree(testPath));
+        NodeUtil testTree = new NodeUtil(root.getTreeOrNull(testPath));
         testTree.addChild(REP_POLICY, JcrConstants.NT_UNSTRUCTURED);
 
         AccessControlPolicyIterator itr = acMgr.getApplicablePolicies(testPath);
@@ -869,7 +869,7 @@ public class AccessControlManagerImplTes
         policy.addEntry(testPrincipal, testPrivileges, true, getGlobRestriction("*"));
         acMgr.setPolicy(testPath, policy);
 
-        NodeUtil aclNode = new NodeUtil(root.getTree(testPath + '/' + REP_POLICY));
+        NodeUtil aclNode = new NodeUtil(root.getTreeOrNull(testPath + '/' + REP_POLICY));
         NodeUtil aceNode = aclNode.addChild("testACE", NT_REP_DENY_ACE);
         aceNode.setString(REP_PRINCIPAL_NAME, "invalidPrincipal");
         aceNode.setNames(REP_PRIVILEGES, PrivilegeConstants.JCR_READ);
@@ -1054,9 +1054,9 @@ public class AccessControlManagerImplTes
         root.commit();
 
         Root root2 = adminSession.getLatestRoot();
-        Tree tree = root2.getTree(testPath);
+        Tree tree = root2.getTreeOrNull(testPath);
         assertTrue(tree.hasChild(REP_POLICY));
-        Tree policyTree = tree.getChild(REP_POLICY);
+        Tree policyTree = tree.getChildOrNull(REP_POLICY);
         assertEquals(NT_REP_ACL, TreeUtil.getPrimaryTypeName(policyTree));
         assertEquals(2, policyTree.getChildrenCount());
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorTest.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorTest.java Mon Apr 29 12:41:59 2013
@@ -45,7 +45,7 @@ public class AccessControlValidatorTest 
     public void before() throws Exception {
         super.before();
 
-        NodeUtil rootNode = new NodeUtil(root.getTree("/"), getNamePathMapper());
+        NodeUtil rootNode = new NodeUtil(root.getTreeOrNull("/"), getNamePathMapper());
         rootNode.addChild(testName, JcrConstants.NT_UNSTRUCTURED);
 
         root.commit();
@@ -56,7 +56,7 @@ public class AccessControlValidatorTest 
     @After
     public void after() throws Exception {
         try {
-            Tree testRoot = root.getTree(testPath);
+            Tree testRoot = root.getTreeOrNull(testPath);
             if (testRoot != null) {
                 testRoot.remove();
                 root.commit();
@@ -67,7 +67,7 @@ public class AccessControlValidatorTest 
     }
 
     private NodeUtil getTestRoot() {
-        return new NodeUtil(root.getTree(testPath));
+        return new NodeUtil(root.getTreeOrNull(testPath));
     }
 
     private NodeUtil createAcl() {



Mime
View raw message