You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Davide Giannella (JIRA)" <ji...@apache.org> on 2019/06/11 10:52:12 UTC

[jira] [Closed] (OAK-8266) Redundant check for existing tree in CompiledPermissionImpl.buildVersionDelegatee

     [ https://issues.apache.org/jira/browse/OAK-8266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Davide Giannella closed OAK-8266.
---------------------------------

bulk close 1.14.0

> Redundant check for existing tree in CompiledPermissionImpl.buildVersionDelegatee
> ---------------------------------------------------------------------------------
>
>                 Key: OAK-8266
>                 URL: https://issues.apache.org/jira/browse/OAK-8266
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, security
>            Reporter: angela
>            Assignee: angela
>            Priority: Minor
>             Fix For: 1.14.0
>
>         Attachments: OAK-8266.patch
>
>
> [~stillalex], i found that the check for existence of the passed tree in {{CompiledPermissionImpl.buildVersionDelegatee}} is redundant, due to the while loop just before calling the method. line 204ff:
> {code}
>                         while (!versionableTree.exists()) {
>                             versionableTree = versionableTree.getParent();
>                         }
>                         return new VersionTreePermission(tree, buildVersionDelegatee(versionableTree), providerCtx.getTreeProvider());
> {code}
> and subsequently:
> {code}
> private TreePermission buildVersionDelegatee(@NotNull Tree versionableTree) {
>         if (!versionableTree.exists()) {
>             return TreePermission.EMPTY;
>         } else if (versionableTree.isRoot()) {
>             return createRootPermission(versionableTree);
>         } 
>         [...]
> }
> {code}
> due to the loop the method {{buildVersionDelegatee}} either gets an existing tree or the root tree. IMO we should remove that extra if (see attached patch). wdyt?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)