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 2015/06/01 09:25:17 UTC
[jira] [Commented] (SLING-4767) Optional sub models are logged as
warn if they cannot be adapted
[ https://issues.apache.org/jira/browse/SLING-4767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14567010#comment-14567010 ]
Konrad Windszus commented on SLING-4767:
----------------------------------------
Instead I fixed it by introducing a new exception class called {{PostConstructException}} which is logged only on level debug because it might be used for validation or flow-control purposes (i.e. might happen on production and should not pollute the log by default).
> Optional sub models are logged as warn if they cannot be adapted
> ----------------------------------------------------------------
>
> Key: SLING-4767
> URL: https://issues.apache.org/jira/browse/SLING-4767
> Project: Sling
> Issue Type: Improvement
> Reporter: Georg Henzler
> Assignee: Konrad Windszus
> Fix For: Sling Models API 1.2.0, Sling Models Impl 1.2.0
>
>
> Currently Sling Models logs the example model \[1] as warning \[2] if the sub model image does not exist. This really should be a debug log as it is totally fine if in optional field cannot be set?
> \[1]
> {code}
> com......mediagallery.MediaGalleryElement
> ...
> @Inject
> @Optional
> @Named(value = ".")
> private Image image;
> {code}
> \[2] org.apache.sling.models.impl.ModelAdapterFactory.injectElement(InjectableElement, Object, Model, DisposalCallbackRegistry, InjectCallback)
> {code}
> // log previous injection error, if there was any
> if (lastInjectionException != null) {
> log.warn("Although falling back to default value worked, injection into {} failed because of: " + lastInjectionException.getMessage(), element.getAnnotatedElement(), lastInjectionException);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)