[ https://issues.apache.org/jira/browse/SLING-11239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17515350#comment-17515350 ]
Robert Munteanu commented on SLING-11239: ----------------------------------------- [~angela] - filed a draft PR with a failing test at https://github.com/apache/sling-org-apache-sling-feature-cpconverter/pull/133 . I won't have time to look into providing a fix as well soon though. > ContentPackage2FeatureModelConverter prone to NPE > ------------------------------------------------- > > Key: SLING-11239 > URL: https://issues.apache.org/jira/browse/SLING-11239 > Project: Sling > Issue Type: Bug > Components: Content-Package to Feature Model Converter > Affects Versions: Content-Package to Feature Model Converter 1.1.14 > Reporter: Angela Schreiber > Priority: Major > Fix For: Content-Package to Feature Model Converter 1.1.16 > > > the {{ContentPackage2FeatureModelConverter}} contains a bunch of fields that > are only populated when calling the corresponding setters. > while the {{ContentPackage2FeatureModelConverterLauncher}} client gets > naturally adjusted when new the converter gets extended, this may easily lead > to NPE when the converter is used outside of the client code. > the most recent example where we ran into a NPE was the introduction of the > 'indexManager' with SLING-11134, but the problem also applies to the > acl-Manager, the bundleSlingInitialContentExtractor and maybe others that get > accessed throughout the conversion without checking for null. > we should either extend the code to handle missing managers/extractors > gracefully in case they are optional, or initialize defaults (e.g. possible > for the indexManager) or verify that the converter has been properly > initialized with all mandatory setters called before running the conversion. > note: ideally fixing this would also make the corresponding getters to return > a non-null value as we have potential NPE also with calls to > {{ContentPackage2FeatureModelConverterLauncher.getAclManager()}}. > cc: [~rombert], [~kpauls] -- This message was sent by Atlassian Jira (v8.20.1#820001)