You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2012/11/09 10:49:07 UTC

svn commit: r1407404 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/

Author: mduerig
Date: Fri Nov  9 09:49:06 2012
New Revision: 1407404

URL: http://svn.apache.org/viewvc?rev=1407404&view=rev
Log:
null checks

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/OakAuthorizableProperties.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/OakAuthorizableProperties.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/OakAuthorizableProperties.java?rev=1407404&r1=1407403&r2=1407404&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/OakAuthorizableProperties.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/OakAuthorizableProperties.java Fri Nov  9 09:49:06 2012
@@ -222,7 +222,7 @@ class OakAuthorizableProperties implemen
     private boolean isAuthorizableProperty(Tree authorizableTree, PropertyState property) {
         // FIXME: add proper check for protection and declaring nt of the
         // FIXME: property using nt functionality provided by nt-plugins
-        return isAuthorizableProperty(property.getName());
+        return property != null && isAuthorizableProperty(property.getName());
     }
 
     private boolean isAuthorizableProperty(String propertyName) {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java?rev=1407404&r1=1407403&r2=1407404&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java Fri Nov  9 09:49:06 2012
@@ -135,9 +135,9 @@ public abstract class ItemDelegate {
      * The underlying {@link org.apache.jackrabbit.oak.api.TreeLocation} of this item.
      * The location is only re-resolved when the revision of this item does not match
      * the revision of the session.
-     * @return  tree location of the underlying item or {@code null} if stale.
+     * @return  tree location of the underlying item or {@link TreeLocation#NULL} if stale.
      */
-    @CheckForNull
+    @Nonnull
     private synchronized TreeLocation getLocationOrNull() {
         if (location != TreeLocation.NULL && sessionDelegate.getRevision() != revision) {
             location = sessionDelegate.getLocation(location.getPath());

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java?rev=1407404&r1=1407403&r2=1407404&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java Fri Nov  9 09:49:06 2012
@@ -96,9 +96,14 @@ public class PropertyDelegate extends It
 
     @Nonnull
     private PropertyState getPropertyState() throws InvalidItemStateException {
-        return getPropertyLocation().getProperty();  // Not null
+        PropertyState property = getPropertyLocation().getProperty();
+        if (property == null) {
+            throw new InvalidItemStateException();
+        }
+        return property;
     }
 
+    @Nonnull
     private PropertyLocation getPropertyLocation() throws InvalidItemStateException {
         TreeLocation location = getLocation();
         if (!(location instanceof PropertyLocation)) {