Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
the code in the "Content-Package to Feature Model Converter" should come with nullabillity annotations for method parameters and return values.
- first checks for list of 'authorizations being null (line 147)
- on line 160 calls 'addPath', which turn calls 'areEmpty' (i.e. checks for null or empty)
- on line 164 calls 'addAclStatement', which in turn checks for null again and also calls 'areEmpty' (ie. checks for null or empty, see also
SLING-9973)
if my counting is correct:
- 4 times testing if the given list is null
- 2 times testing if the given list is empty
where it could be just 1 single call to 'areEmpty' at the beginning of the top method addStatements and return if that condition was met. i wouldn't be surprised if similar things could be found elsewhere in the module.
IMHO consistently using notnull/nullable annotations and being conscious about it helps to prevent that kind of mistakes and makes the code more robust, easier to test and to read.
Attachments
Issue Links
- fixes
-
SLING-9973 DefaultAclManager.addAclStatement: redundant check for null
- Closed
- links to