[
https://issues.apache.org/jira/browse/SLING-4644?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14505642#comment-14505642
]
Carsten Ziegeler commented on SLING-4644:
-----------------------------------------
I assume the reason was to follow the contract and let not any other exception
be thrown from getResource or resolve, like to catch an NPE etc. So we have two
options, either we explicitely catch SlingException and rethrow it and leave
the handling for everything else in place - or we remove the try/catch
completely.
The first solution is closer to what we have right now, but surely might hide
problems.
> SlingException is not properly propagated by
> ResourceProviderEntry.getInternalResource(...)
> -------------------------------------------------------------------------------------------
>
> Key: SLING-4644
> URL: https://issues.apache.org/jira/browse/SLING-4644
> Project: Sling
> Issue Type: Bug
> Components: ResourceResolver
> Affects Versions: Resource Resolver 1.2.4
> Reporter: Konrad Windszus
>
> Currently any exception thrown from the
> {{ResourceResolverEntry.getResourceFromProviders}}
> (https://github.com/apache/sling/blob/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/ResourceProviderEntry.java#L389),
> is caught by {{ResourceProviderEntry.getInternalResource}}
> (https://github.com/apache/sling/blob/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/ResourceProviderEntry.java#L383)
> and only logged on debug level. This leads to the case that if the
> underlying resource provider throws a {{SlingException}} during its
> {{getResource}} that exception is gonna be swallowed (and not rethrown
> properly). Only a log statement with level debug would give some explanation
> on why the getResource would fail. But according to the javadoc the
> {{ResourceResolver.getResource}} should rather throw a {{SlingException}} in
> that case.
> I would suggest to rewrite that exception handling in
> https://github.com/apache/sling/blob/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/ResourceProviderEntry.java#L383
> to properly propagate all {{SlingException}}s.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)