[
https://issues.apache.org/jira/browse/SLING-10137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Konrad Windszus resolved SLING-10137.
-------------------------------------
Resolution: Duplicate
> SlingModelAdapterFactory.createModel() returns null
> ---------------------------------------------------
>
> Key: SLING-10137
> URL: https://issues.apache.org/jira/browse/SLING-10137
> Project: Sling
> Issue Type: Bug
> Components: Sling Models
> Affects Versions: Models Implementation 1.4.16
> Reporter: René Grob
> Priority: Major
>
> According to the documentation
> ([https://sling.apache.org/documentation/bundles/models.html#modelfactory-since-120])
> null checks are not necessary. However if a {{@PostConstruct}} method
> returns false,
> {{org.apache.sling.models.impl.ModelAdapterFactory.invokePostConstruct()}}
> will return {{null}}. This will cause
> {{org.apache.sling.models.impl.ModelAdapterFactory.createModel()}} to fail
> because {{result.getThrowable()}} returns {{null}} which will result in
> {{throw null}}.
> In order to fix this {{internalCreateModel()}} needs to return a valid
> throwable to indicate that the {{@PostConstruct}} method returned {{false}}
> and therefore no model was created.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)