jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1436856 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
Date Tue, 22 Jan 2013 12:00:56 GMT
Author: mduerig
Date: Tue Jan 22 12:00:55 2013
New Revision: 1436856

URL: http://svn.apache.org/viewvc?rev=1436856&view=rev
Log:
simplify

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java?rev=1436856&r1=1436855&r2=1436856&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
Tue Jan 22 12:00:55 2013
@@ -21,6 +21,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Queue;
+
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.jcr.Node;
@@ -49,7 +50,6 @@ import org.apache.jackrabbit.commons.ite
 import org.apache.jackrabbit.oak.api.PropertyState;
 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.core.ReadOnlyTree;
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
@@ -153,17 +153,13 @@ public abstract class ReadOnlyNodeTypeMa
      */
     @Nonnull
     public static ReadOnlyNodeTypeManager getInstance(NodeState root) {
-        Tree tree = new ReadOnlyTree(root);
-        for (String name : PathUtils.elements(NODE_TYPES_PATH)) {
-            tree = tree.getChild(name);
-            if (tree == null) {
-                // No node types in content, so use an empty node
-                tree = new ReadOnlyTree(MemoryNodeState.EMPTY_NODE);
-                break;
-            }
-        }
+        Tree tree = new ReadOnlyTree(root).getLocation()
+                .getChild(NODE_TYPES_PATH.substring(1)).getTree();
+
+        final Tree types = tree == null
+            ? new ReadOnlyTree(MemoryNodeState.EMPTY_NODE)  // No node types in content,
use an empty node
+            : tree;
 
-        final Tree types = tree;
         return new ReadOnlyNodeTypeManager() {
             @Override
             protected Tree getTypes() {



Mime
View raw message