kwin commented on a change in pull request #52:
URL:
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/52#discussion_r742836634
##########
File path:
src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
##########
@@ -180,8 +184,25 @@ public void close() {
if (factory.shouldLogResourceResolverClosing()) {
closedResolverException = new Exception("Stack Trace");
}
+ clearPropertyMap();
this.factory.unregister(this, this.control);
}
+
+
+ protected void clearPropertyMap() {
+ if (propertyMap != null) {
+ for (Object value : propertyMap.values()) {
+ if (value instanceof Closeable) {
+ try {
+ ((Closeable) value).close();
+ } catch (IOException e) {
Review comment:
Then I disagree, just swallowing every exception without even logging
calls for trouble. I would instead:
Catch the IOException, create a new exception object and put all those as
suppressed exceptions. Then close the resource resolver and afterwards throw
the newly created exception with all suppressed exceptions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]