You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Karl Pauls (Jira)" <ji...@apache.org> on 2021/01/12 22:27:01 UTC
[jira] [Resolved] (SLING-9973) DefaultAclManager.addAclStatement:
redundant check for null
[ https://issues.apache.org/jira/browse/SLING-9973?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Karl Pauls resolved SLING-9973.
-------------------------------
Resolution: Fixed
I addressed this as part of SLING-9974
> 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.0.26
>
>
> 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)