jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "angela (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (OAK-8266) Redundant check for existing tree in CompiledPermissionImpl.buildVersionDelegatee
Date Tue, 23 Apr 2019 12:51:00 GMT

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

angela updated OAK-8266:
------------------------
    Description: 
[~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.

  was:[~stillalex], i found that the check for existence of the passed tree in 


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



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

Mime
View raw message