jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1510444 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/ReadOnlyVersionManager.java oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java
Date Mon, 05 Aug 2013 12:15:40 GMT
Author: mreutegg
Date: Mon Aug  5 12:15:40 2013
New Revision: 1510444

URL: http://svn.apache.org/r1510444
Log:
OAK-930: VersionManager#isCheckedOut throws IllegalStateException

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/ReadOnlyVersionManager.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/ReadOnlyVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/ReadOnlyVersionManager.java?rev=1510444&r1=1510443&r2=1510444&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/ReadOnlyVersionManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/ReadOnlyVersionManager.java
Mon Aug  5 12:15:40 2013
@@ -64,7 +64,7 @@ public abstract class ReadOnlyVersionMan
 
     /**
      * Returns {@code true} if the tree is checked out; otherwise
-     * {@code false}.
+     * {@code false}. The root node is always considered checked out.
      *
      * @param tree the tree to check.
      * @return whether the tree is checked out or not.
@@ -74,8 +74,6 @@ public abstract class ReadOnlyVersionMan
             PropertyState p = tree.getProperty(VersionConstants.JCR_ISCHECKEDOUT);
             if (p != null) {
                 return p.getValue(Type.BOOLEAN);
-            } else if (tree.isRoot()) {
-                return true;
             }
         } else {
             // FIXME: this actually means access to the tree is restricted
@@ -85,8 +83,12 @@ public abstract class ReadOnlyVersionMan
             // but it may mean oak-jcr sees a node as checked out even though
             // it is in fact read-only because of a checked-in ancestor.
         }
-        // otherwise return checkedOut status of parent
-        return isCheckedOut(tree.getParent());
+        if (tree.isRoot()) {
+            return true;
+        } else {
+            // otherwise return checkedOut status of parent
+            return isCheckedOut(tree.getParent());
+        }
     }
 
     /**

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java?rev=1510444&r1=1510443&r2=1510444&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java
Mon Aug  5 12:15:40 2013
@@ -31,7 +31,6 @@ import org.apache.jackrabbit.oak.jcr.Jcr
 import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import static org.junit.Assert.assertFalse;
@@ -40,7 +39,7 @@ import static org.junit.Assert.assertTru
 public class VersionTest {
 
     private Repository repository;
-    private List<Session> sessions = new ArrayList();
+    private List<Session> sessions = new ArrayList<Session>();
 
     @Before
     public void before() throws Exception {
@@ -49,7 +48,8 @@ public class VersionTest {
         Session admin = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
         sessions.add(admin);
         Node testNode = admin.getRootNode().addNode("testNode");
-        AccessControlUtils.addAccessControlEntry(admin, "/testNode", EveryonePrincipal.getInstance(),
new String[]{Privilege.JCR_READ}, true);
+        AccessControlUtils.addAccessControlEntry(admin, testNode.getPath(),
+                EveryonePrincipal.getInstance(), new String[]{Privilege.JCR_READ}, true);
         admin.save();
     }
 
@@ -59,9 +59,9 @@ public class VersionTest {
             s.logout();
         }
         repository = null;
+        sessions = null;
     }
 
-    @Ignore("OAK-930") // FIXME
     @Test
     public void testNodeIsCheckedOut() throws RepositoryException {
         Session s = repository.login(new GuestCredentials());



Mime
View raw message