jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1342179 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: core/TreeImpl.java spi/state/NodeState.java
Date Thu, 24 May 2012 09:46:44 GMT
Author: mduerig
Date: Thu May 24 09:46:43 2012
New Revision: 1342179

URL: http://svn.apache.org/viewvc?rev=1342179&view=rev
Log:
OAK-37: Use nullability annotation to enforce/document API contract
- add nullability annotations to NodeState
- fix possible null references

Modified:
    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/spi/state/NodeState.java

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=1342179&r1=1342178&r2=1342179&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
Thu May 24 09:46:43 2012
@@ -131,7 +131,7 @@ public class TreeImpl implements Tree, P
                     // ... and did have it before. So...
                     PropertyState base = baseState.getProperty(name);
                     PropertyState head = getProperty(name);
-                    if (base.equals(head)) {
+                    if (base == null ? head == null : base.equals(head)) {
                         // ...it's EXISTING if it hasn't changed
                         return Status.EXISTING;
                     } else {

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=1342179&r1=1342178&r2=1342179&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
Thu May 24 09:46:43 2012
@@ -18,6 +18,9 @@ package org.apache.jackrabbit.oak.spi.st
 
 import org.apache.jackrabbit.oak.api.PropertyState;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 /**
  * A node in a content tree consists of child nodes and properties, each
  * of which evolves through different states during its lifecycle. This
@@ -103,6 +106,7 @@ public interface NodeState {
      * @param name name of the property to return
      * @return named property, or {@code null} if not found
      */
+    @CheckForNull
     PropertyState getProperty(String name);
 
     /**
@@ -120,6 +124,7 @@ public interface NodeState {
      *
      * @return properties in some stable order
      */
+    @Nonnull
     Iterable<? extends PropertyState> getProperties();
 
     /**
@@ -134,6 +139,7 @@ public interface NodeState {
      * @param name name of the child node to return
      * @return named child node, or {@code null} if not found
      */
+    @CheckForNull
     NodeState getChildNode(String name);
 
     /**
@@ -150,6 +156,7 @@ public interface NodeState {
      * dependent and may change across different states of the same node.
      * @return  child node entries in some stable order
      */
+    @Nonnull
     Iterable<? extends ChildNodeEntry> getChildNodeEntries();
 
 }



Mime
View raw message