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 "angela (JIRA)" <ji...@apache.org> on 2019/04/26 12:48:00 UTC

[jira] [Resolved] (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 ]

angela resolved OAK-8266.
-------------------------
    Resolution: Fixed

Committed revision 1858199.
moved the while loop to {{buildVersionDelegatee}}, which makes it obvious that the extra check for existence is not needed.

> 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
>         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)