Unclosed Resource resolver - Custom workflow step
All,
I have a custom process step within the dam update asset workflow where the step needs a resource resolver instance which I get from the workflow session via adaptTo
ResourceResolver resResolver = workflowSession.adaptTo(ResourceResolver.class);
I do NOT have a closeable try block as in below since i am not opening it..
try(ResourceResolver resResolver = workflowSession.adaptTo(ResourceResolver.class))
using com.adobe.granite.workflow.WorkflowSession
I noticed the "Unclosed resolver opened here" at INFO log level and at the above line.
Since it is not something i have opened, per my understanding, i don't believe i should be closing it.
Just an FYI: This resource resolver instance is then used to make an update to the metadata, i see ACS using similar approach just that i am not using autoclosable try cause i am not opening it, wonder why we need it?
https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/util/impl/WorkflowHelperImpl.java
https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/workflow/process/impl/CopyPropertiesProcess.java
public final ResourceResolver getResourceResolver(com.adobe.granite.workflow.WorkflowSession workflowSession) {
return workflowSession.adaptTo(ResourceResolver.class);
}
cc @joerghoh
