jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1537474 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
Date Thu, 31 Oct 2013 13:04:00 GMT
Author: angela
Date: Thu Oct 31 13:04:00 2013
New Revision: 1537474

URL: http://svn.apache.org/r1537474
Log:
OAK-1135 : NPE in CompiledPermissionImpl.getTreePermission() 

- slight modification, add log output if versionable node/path cannot be resolved

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java?rev=1537474&r1=1537473&r2=1537474&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
Thu Oct 31 13:04:00 2013
@@ -196,22 +196,24 @@ final class CompiledPermissionImpl imple
                 } else {
                     TreeLocation tl = getLocation(tree, null);
                     if (tl == null) {
+                        log.warn("Cannot retrieve versionable node for " + tree.getPath());
                         return TreePermission.EMPTY;
                     } else {
                         // TODO: may return wrong results in case of restrictions
                         // TODO that would match the path of the versionable node
                         // TODO (or item in the subtree) but that item no longer exists
                         // TODO -> evaluation by path would be more accurate (-> see
#isGranted)
-                        while (!tl.exists()) {
+                        while (!tl.exists() || tl.getProperty() != null) {
                             tl = tl.getParent();
                         }
                         Tree versionableTree = tl.getTree();
                         if (versionableTree == null) {
-                            // for PropertyLocations
-                            versionableTree = tl.getParent().getTree();
+                            log.warn("Cannot retrieve versionable tree for {0}; versionable
location {1} does not resolve to an existing tree.", tree.getPath(), tl.getPath());
+                            return TreePermission.EMPTY;
+                        } else {
+                            TreePermission pp = getParentPermission(versionableTree, TreeTypeProvider.TYPE_VERSION);
+                            return new TreePermissionImpl(versionableTree, TreeTypeProvider.TYPE_VERSION,
pp);
                         }
-                        TreePermission pp = getParentPermission(versionableTree, TreeTypeProvider.TYPE_VERSION);
-                        return new TreePermissionImpl(versionableTree, TreeTypeProvider.TYPE_VERSION,
pp);
                     }
                 }
             case TreeTypeProvider.TYPE_PERMISSION_STORE:



Mime
View raw message