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

Karl Pauls closed SLING-9973.
-----------------------------

> DefaultAclManager.addAclStatement: redundant check for null
> -----------------------------------------------------------
>
>                 Key: SLING-9973
>                 URL: https://issues.apache.org/jira/browse/SLING-9973
>             Project: Sling
>          Issue Type: Improvement
>          Components: Content-Package to Feature Model Converter
>            Reporter: Angela Schreiber
>            Assignee: Karl Pauls
>            Priority: Minor
>             Fix For: Content-Package to Feature Model Converter 1.1.0
>
>
> method on 
> https://github.com/apache/sling-org-apache-sling-feature-cpconverter/blob/master/src/main/java/org/apache/sling/feature/cpconverter/accesscontrol/DefaultAclManager.java#L242
>  starts as follows:
> {code}
> private static void addAclStatement(Formatter formatter, String systemUser, 
> List<AccessControlEntry> authorizations) {
>         if (authorizations == null || areEmpty(authorizations)) {
>             return;
>         }
>         [...]
> {code}
> utility method {{areEmpty}}:
> {code}
> private static boolean areEmpty(List<AccessControlEntry> authorizations) {
>         return authorizations == null || authorizations.isEmpty();
>     }
> {code}
> the extra check for null in {{addAclStatement}} can therefore be omitted.... 
> but i suspect one got tricked by the method name.... IMHO it would be better 
> to rename the utility method to {{isNullOrEmpty}} or {{areNullOrEmpty}} (if 
> one considers a list being a plural object).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to