[
https://issues.apache.org/jira/browse/SLING-4630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14498523#comment-14498523
]
Stefan Seifert commented on SLING-4630:
---------------------------------------
bq. If a post construct method throws an exception, that is NOT a technical
problem but can be fixed by the user
i do not agree - if the post construct throws an error due to missing content,
its a problem in the code, not from the user.
the post construct code logic that really has application errors, and they
should be logged as error the same way as e.g. errors in sightly templates.
> Sling Models should not log exceptions in post construct methods as error
> -------------------------------------------------------------------------
>
> Key: SLING-4630
> URL: https://issues.apache.org/jira/browse/SLING-4630
> Project: Sling
> Issue Type: Improvement
> Components: Extensions
> Affects Versions: Sling Models Implementation 1.1.0
> Reporter: Georg Henzler
> Attachments: SLING-4630-patch1.patch, SLING-4630-patch2.patch
>
>
> If a post construct method throws an exception, that is NOT a technical
> problem but can be fixed by the user (e.g. some content problem that can be
> fixed by an author directly), at the moment this is still logged as an error
> in the log file (where it should really a debug log at most).
> We could disable the error log for post construct messages completely
> (patch1, solves the problem for ModelAdapterFactory.createModel() but for
> ModelAdapterFactory.getAdapter() this would swallow the exception, also see
> SLING-3709) or we just ensure, that for the case we throw the exception we
> don't *throw and log* the exception (which is bad practice anyway, patch2).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)