jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1447780 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/api/ main/java/org/apache/jackrabbit/oak/core/ main/java/org/apache/jackrabbit/oak/kernel/ main/java/org/apache/jackrabbit/oak/plugins/memory/ main/java/o...
Date Tue, 19 Feb 2013 16:05:27 GMT
Author: alexparvulescu
Date: Tue Feb 19 16:05:27 2013
New Revision: 1447780

URL: http://svn.apache.org/r1447780
Log:
OAK-635 SegmentMK NPE in SegmentNodeState#getChildNode

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeState.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImplTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java?rev=1447780&r1=1447779&r2=1447780&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java Tue
Feb 19 16:05:27 2013
@@ -179,7 +179,7 @@ public interface Tree {
      *         child exists or the child is not accessible.
      */
     @CheckForNull
-    Tree getChild(String name);
+    Tree getChild(@Nonnull String name);
 
     /**
      * Determine if a child of this {@code Tree} instance exists. If no child
@@ -189,7 +189,7 @@ public interface Tree {
      * @return {@code true} if and only if a child with the given {@code name}
      *         exists and is accessible for the current content session.
      */
-    boolean hasChild(String name);
+    boolean hasChild(@Nonnull String name);
 
     /**
      * Determine the number of children of this {@code Tree} instance taking

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java?rev=1447780&r1=1447779&r2=1447780&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
Tue Feb 19 16:05:27 2013
@@ -136,7 +136,7 @@ public class ReadOnlyTree implements Tre
     }
 
     @Override
-    public ReadOnlyTree getChild(String name) {
+    public ReadOnlyTree getChild(@Nonnull String name) {
         NodeState child = state.getChildNode(name);
         if (child != null) {
             return new ReadOnlyTree(this, name, child);
@@ -156,8 +156,8 @@ public class ReadOnlyTree implements Tre
     }
 
     @Override
-    public boolean hasChild(String name) {
-        return state.getChildNode(name) != null;
+    public boolean hasChild(@Nonnull String name) {
+        return state.hasChildNode(name);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java?rev=1447780&r1=1447779&r2=1447780&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
Tue Feb 19 16:05:27 2013
@@ -198,7 +198,8 @@ public class TreeImpl implements Tree {
     }
 
     @Override
-    public TreeImpl getChild(String name) {
+    public TreeImpl getChild(@Nonnull String name) {
+        checkNotNull(name);
         root.checkLive();
         TreeImpl child = internalGetChild(name);
         if (child != null && canRead(child)) {
@@ -239,8 +240,7 @@ public class TreeImpl implements Tree {
     }
 
     @Override
-    public boolean hasChild(String name) {
-        root.checkLive();
+    public boolean hasChild(@Nonnull String name) {
         return getChild(name) != null;
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java?rev=1447780&r1=1447779&r2=1447780&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
Tue Feb 19 16:05:27 2013
@@ -205,6 +205,7 @@ public final class KernelNodeState exten
 
     @Override
     public NodeState getChildNode(String name) {
+        checkNotNull(name);
         init();
         String childPath = childPaths.get(name);
         if (childPath == null && childNodeCount > MAX_CHILD_NODE_NAMES) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java?rev=1447780&r1=1447779&r2=1447780&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
Tue Feb 19 16:05:27 2013
@@ -577,11 +577,13 @@ public class MemoryNodeBuilder implement
 
         @Override
         public boolean hasChildNode(String name) {
+            checkNotNull(name);
             return withNodes(base, nodes).hasChildNode(name);
         }
 
         @Override
         public NodeState getChildNode(String name) {
+            checkNotNull(name);
             return withNodes(base, nodes).getChildNode(name); // mutable
         }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeState.java?rev=1447780&r1=1447779&r2=1447780&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeState.java
Tue Feb 19 16:05:27 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.plugins.memory;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.state.AbstractNodeState;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
@@ -78,11 +80,13 @@ public class MemoryNodeState extends Abs
 
     @Override
     public boolean hasChildNode(String name) {
+        checkNotNull(name);
         return nodes.containsKey(name);
     }
 
     @Override
     public NodeState getChildNode(String name) {
+        checkNotNull(name);
         return nodes.get(name);
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java?rev=1447780&r1=1447779&r2=1447780&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
Tue Feb 19 16:05:27 2013
@@ -204,6 +204,7 @@ public class ModifiedNodeState extends A
 
     @Override
     public boolean hasChildNode(String name) {
+        checkNotNull(name);
         NodeState child = nodes.get(name);
         if (child != null) {
             return true;
@@ -216,6 +217,7 @@ public class ModifiedNodeState extends A
 
     @Override
     public NodeState getChildNode(String name) {
+        checkNotNull(name);
         NodeState child = nodes.get(name);
         if (child != null) {
             return child;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java?rev=1447780&r1=1447779&r2=1447780&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
Tue Feb 19 16:05:27 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.spi.state;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import org.apache.jackrabbit.oak.api.PropertyState;
 
 import com.google.common.base.Function;
@@ -65,6 +67,7 @@ public abstract class AbstractNodeState 
 
     @Override
     public NodeState getChildNode(String name) {
+        checkNotNull(name);
         for (ChildNodeEntry entry : getChildNodeEntries()) {
             if (name.equals(entry.getName())) {
                 return entry.getNodeState();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java?rev=1447780&r1=1447779&r2=1447780&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
Tue Feb 19 16:05:27 2013
@@ -97,7 +97,7 @@ public interface NodeBuilder {
      * @return {@code true} if the named child node exists,
      *         {@code false} otherwise
      */
-    boolean hasChildNode(String name);
+    boolean hasChildNode(@Nonnull String name);
 
     /**
      * Returns the names of current child nodes.
@@ -213,6 +213,6 @@ public interface NodeBuilder {
      * @return child builder
      */
     @Nonnull
-    NodeBuilder child(String name);
+    NodeBuilder child(@Nonnull String name);
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeState.java?rev=1447780&r1=1447779&r2=1447780&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeState.java
Tue Feb 19 16:05:27 2013
@@ -134,7 +134,7 @@ public interface NodeState {
      * @return {@code true} if the named child node exists,
      *         {@code false} otherwise
      */
-    boolean hasChildNode(String name);
+    boolean hasChildNode(@Nonnull String name);
 
     /**
      * Returns the named child node. The name is an opaque string and
@@ -149,7 +149,7 @@ public interface NodeState {
      * @return named child node, or {@code null} if not found
      */
     @CheckForNull
-    NodeState getChildNode(String name);
+    NodeState getChildNode(@Nonnull String name);
 
     /**
      * Returns the number of child nodes of this node.

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=1447780&r1=1447779&r2=1447780&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
Tue Feb 19 16:05:27 2013
@@ -557,6 +557,7 @@ public class AccessControlManagerImplTes
         // TODO
     }
 
+    @Ignore("OAK-644")
     @Test
     public void testSetPolicy() throws Exception {
         ACL acl = getApplicablePolicy(testPath);
@@ -575,6 +576,7 @@ public class AccessControlManagerImplTes
         assertArrayEquals(acl.getAccessControlEntries(), acl2.getAccessControlEntries());
     }
 
+    @Ignore("OAK-644")
     @Test
     public void testSetPolicyWritesAcContent() throws Exception {
         ACL acl = getApplicablePolicy(testPath);
@@ -695,4 +697,4 @@ public class AccessControlManagerImplTes
     public void testRemoveRepoPolicy() throws Exception {
         // TODO
     }
-}
\ No newline at end of file
+}



Mime
View raw message