jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1367559 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: PropertyDelegate.java PropertyImpl.java
Date Tue, 31 Jul 2012 14:06:59 GMT
Author: angela
Date: Tue Jul 31 14:06:58 2012
New Revision: 1367559

URL: http://svn.apache.org/viewvc?rev=1367559&view=rev
Log:
OAK-214 : PropertyImpl#getParent violates JCR API  (work in progress)

initial fix on PropertyImpl and PropertyDelegate that throws AccessDenied if the parent delegate
is null
subsequent commits need to cleanup the calculation of the property status allowing the parent
to be
null if it is not accessible.

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java

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=1367559&r1=1367558&r2=1367559&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
Tue Jul 31 14:06:58 2012
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.jcr;
 
 import java.util.List;
 
+import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.jcr.InvalidItemStateException;
 import javax.jcr.Value;
@@ -77,7 +78,7 @@ public class PropertyDelegate extends It
     }
 
     @Override
-    @Nonnull
+    @CheckForNull
     public NodeDelegate getParent() throws InvalidItemStateException {
         return new NodeDelegate(sessionDelegate, getParentTree());
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java?rev=1367559&r1=1367558&r2=1367559&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
Tue Jul 31 14:06:58 2012
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.List;
 import javax.annotation.Nonnull;
+import javax.jcr.AccessDeniedException;
 import javax.jcr.Binary;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.ItemVisitor;
@@ -73,7 +74,12 @@ public class PropertyImpl extends ItemIm
         return sessionDelegate.perform(new SessionOperation<NodeImpl>() {
             @Override
             public NodeImpl perform() throws RepositoryException {
-                return new NodeImpl(dlg.getParent());
+                NodeDelegate parent = dlg.getParent();
+                if (parent == null) {
+                    throw new AccessDeniedException();
+                } else {
+                    return new NodeImpl(dlg.getParent());
+                }
             }
         });
     }



Mime
View raw message