[ https://issues.apache.org/jira/browse/SLING-5637?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Carsten Ziegeler resolved SLING-5637. ------------------------------------- Resolution: Fixed Assignee: Carsten Ziegeler Applied the patch > Resource.delete is not called if resource is adaptable to Node > -------------------------------------------------------------- > > Key: SLING-5637 > URL: https://issues.apache.org/jira/browse/SLING-5637 > Project: Sling > Issue Type: Bug > Components: Servlets > Affects Versions: Servlets Post 2.3.8 > Reporter: Carsten Ziegeler > Assignee: Carsten Ziegeler > Fix For: Servlets Post 2.3.10 > > > If a resource is adaptable to Node, the node is directly removed. > ResourceProvider.delete is never invoked. > While this works with the JcrResourceProvider it does not work with any other > resource provider providing resources which adapt to a node > Proposed solution: > {code} > ### Eclipse Workspace Patch 1.0 > #P org.apache.sling.servlets.post > Index: > src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java > =================================================================== > --- > src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java > (Revision 1737673) > +++ > src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java > (Arbeitskopie) > @@ -58,15 +58,15 @@ > // SLING-3203: selectors, extension and suffix make no sense here and > // might lead to deleting other resources than the one the user > means. > final RequestPathInfo rpi = request.getRequestPathInfo(); > - if( (rpi.getSelectors() != null && rpi.getSelectors().length > 0) > + if( (rpi.getSelectors() != null && rpi.getSelectors().length > 0) > || (rpi.getExtension() != null && > rpi.getExtension().length() > 0) > || (rpi.getSuffix() != null && rpi.getSuffix().length() > > 0)) { > response.setStatus( > - HttpServletResponse.SC_FORBIDDEN, > + HttpServletResponse.SC_FORBIDDEN, > "DeleteOperation request cannot include any selectors, > extension or suffix"); > return; > } > - > + > final VersioningConfiguration versioningConfiguration = > getVersioningConfiguration(request); > final boolean deleteChunks = isDeleteChunkRequest(request); > final Iterator<Resource> res = getApplyToResources(request); > @@ -100,19 +100,17 @@ > } else { > checkoutIfNecessary(node.getParent(), changes, > versioningConfiguration); > - node.remove(); > } > - > - } else { > - try { > - resource.getResourceResolver().delete(resource); > - } catch (final PersistenceException pe) { > - if (pe.getCause() instanceof RepositoryException) { > - throw (RepositoryException) pe.getCause(); > - } > - throw new RepositoryException(pe); > + } > + try { > + resource.getResourceResolver().delete(resource); > + } catch (final PersistenceException pe) { > + if (pe.getCause() instanceof RepositoryException) { > + throw (RepositoryException) pe.getCause(); > } > + throw new RepositoryException(pe); > } > + > changes.add(Modification.onDeleted(resource.getPath())); > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)