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 2016/12/06 13:29:58 UTC

[jira] [Comment Edited] (SLING-6369) Exceptions thrown by reflection API in ModelAdapterFactory#setField() are not logged

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

Konrad Windszus edited comment on SLING-6369 at 12/6/16 1:29 PM:
-----------------------------------------------------------------

The reason for that is that the {{o.a.s.models.factory.MissingElementsException#getMessage()}} does only give out the first cause, but not any subsequent one to the root. The code in https://github.com/apache/sling/blob/trunk/bundles/extensions/models/api/src/main/java/org/apache/sling/models/factory/MissingElementsException.java#L48 needs to be refactored to evaluate/print all causes up to the root.

That code should rather use {{Throwable.printStackTrace(...)}} to expose in the same format as all other exceptions.


was (Author: kwin):
The reason for that is that the {{o.a.s.models.factory.MissingElementsException#getMessage()}} does only give out the first cause, but not any subsequent one to the root. The code in https://github.com/apache/sling/blob/trunk/bundles/extensions/models/api/src/main/java/org/apache/sling/models/factory/MissingElementsException.java#L48 needs to be refactored to evaluate/print all causes up to the root.

> Exceptions thrown by reflection API in ModelAdapterFactory#setField() are not logged
> ------------------------------------------------------------------------------------
>
>                 Key: SLING-6369
>                 URL: https://issues.apache.org/jira/browse/SLING-6369
>             Project: Sling
>          Issue Type: Bug
>    Affects Versions: Sling Models API 1.3.0
>            Reporter: Dirk Rudolph
>            Priority: Minor
>
> We got the following exception due to  "reflection issues"
> {code}
> 06.12.2016 09:36:08.242 *WARN* [172.19.143.86 [1481013368241] GET /[…] HTTP/1.1] org.apache.sling.models.impl.ModelAdapterFactory Could not adapt to model
> org.apache.sling.models.factory.MissingElementsException: Could not inject all required fields into class my.Model
> Could not inject private org.apache.sling.api.adapter.AdapterManager my.Model.adapterManager caused by Could not inject field due to reflection issues
>         at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:549)
>         at org.apache.sling.models.impl.ModelAdapterFactory.internalCreateModel(ModelAdapterFactory.java:310)
>         at org.apache.sling.models.impl.ModelAdapterFactory.getAdapter(ModelAdapterFactory.java:186)
>         at org.apache.sling.adapter.internal.AdapterManagerImpl.getAdapter(AdapterManagerImpl.java:147)
>         at org.apache.sling.api.adapter.SlingAdaptable.adaptTo(SlingAdaptable.java:104)
>         at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.adaptTo(ResourceResolverImpl.java:837)
>         at […]
>         at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
>         at com.adobe.granite.resourceresolverhelper.impl.ResourceResolverHelperImpl.doFilter(ResourceResolverHelperImpl.java:84)
>         at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
>         at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:129)
>         at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
>         at org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProcessorImpl.java:151)
>         at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:216)
>         at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:85)
>         at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:79)
>         at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308)
>         at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
>         at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
>         at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:89)
>         at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
>         at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
>         at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:290)
>         at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
>         at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
>         at org.apache.sling.featureflags.impl.FeatureManager.doFilter(FeatureManager.java:116)
>         at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
>         at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
>         at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:75)
>         at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
>         at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
>         at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:129)
>         at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
>         at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
>         at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:124)
>         at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:61)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>         at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
>         at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
>         at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
>         at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
>         at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
>         at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
>         at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
>         at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>         at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
>         at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
>         at org.eclipse.jetty.server.Server.handle(Server.java:499)
>         at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
>         at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
>         at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
>         at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
>         at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
>         at java.lang.Thread.run(Thread.java:745)
> {code}
> Unfortunately, the actual exception, isn't logged, making debugging the issue quite difficult. From the exception message I'm only able to find the place where it is thrown but not what exactly was thrown. My expectation is that the cause is logged as well.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)