Author: cziegeler
Date: Tue Feb 9 12:33:03 2016
New Revision: 1729371
URL: http://svn.apache.org/viewvc?rev=1729371&view=rev
Log:
SLING-5500 : ResourceResolver#remove(Resource) fails on JcrResource that is a
Property
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java?rev=1729371&r1=1729370&r2=1729371&view=diff
==============================================================================
---
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
(original)
+++
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
Tue Feb 9 12:33:03 2016
@@ -436,18 +436,18 @@ public class JcrResourceProvider extends
@Override
public void delete(final @Nonnull ResolveContext<JcrProviderState> ctx,
final @Nonnull Resource resource)
throws PersistenceException {
- // try to adapt to Node
- Node node = resource.adaptTo(Node.class);
+ // try to adapt to Item
+ Item item = resource.adaptTo(Item.class);
try {
- if ( node == null ) {
+ if ( item == null ) {
final String jcrPath =
pathMapper.mapResourcePathToJCRPath(resource.getPath());
if (jcrPath == null) {
log.debug("delete: {} maps to an empty JCR path",
resource.getPath());
throw new PersistenceException("Unable to delete
resource", null, resource.getPath(), null);
}
- node = ctx.getProviderState().getSession().getNode(jcrPath);
+ item = ctx.getProviderState().getSession().getItem(jcrPath);
}
- node.remove();
+ item.remove();
} catch (final RepositoryException e) {
throw new PersistenceException("Unable to delete resource", e,
resource.getPath(), null);
}