You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (Jira)" <ji...@apache.org> on 2021/02/11 16:18:00 UTC

[jira] [Comment Edited] (SLING-10137) SlingModelAdapterFactory.createModel() returns null

    [ https://issues.apache.org/jira/browse/SLING-10137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17283118#comment-17283118 ] 

Konrad Windszus edited comment on SLING-10137 at 2/11/21, 4:17 PM:
-------------------------------------------------------------------

This is already reported in SLING-8079. But the title of this JIRA issue is wrong, because null is IMHO never returned from SlingModelAdapterFactory.createModel(), rather the IllegalStateException reported in SLING-8079, right?


was (Author: kwin):
This is already reported in SLING-8079.

> 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.3.4#803005)