jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig <mdue...@apache.org>
Subject Re: svn commit: r1547174 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol: AccessControlValidator.java AccessControlValidatorProvider.java
Date Tue, 03 Dec 2013 08:08:56 GMT

On 2.12.13 9:19 , jukka@apache.org wrote:
> Author: jukka
> Date: Mon Dec  2 20:19:58 2013
> New Revision: 1547174
>
> URL: http://svn.apache.org/r1547174
> Log:
> OAK-1252: Lazy privilege access in AccessControlValidator
>
> Defer privilege access to when they're really needed

[...]

>           for (String privilegeName : privilegeNames) {
> -            if (privilegeName == null || !privileges.containsKey(privilegeName)) {
> +            try {
> +                Privilege privilege = privilegeManager.getPrivilege(privilegeName);
> +                if (privilege.isAbstract()) {
> +                    throw accessViolation(11, "Abstract privilege " + privilegeName);
> +                }
> +            } catch (AccessControlException e) {
>                   throw accessViolation(10, "Invalid privilege " + privilegeName);
> -            }
> -
> -            Privilege privilege = privileges.get(privilegeName);
> -            if (privilege.isAbstract()) {
> -                throw accessViolation(11, "Abstract privilege " + privilegeName);
> +            } catch (RepositoryException e) {
> +                throw new RuntimeException(e);
>               }
>           }
>       }

Could we include some form of an explanation why a RuntimeException is 
thrown here. E.g. throw a tailored descendant of RuntimeException 
including some extra message?

Michael

Mime
View raw message