sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-org-apache-sling-resourceresolver] 05/10: SLING-2691 : Correctly update mapping if a jcr:content node is removed
Date Tue, 07 Nov 2017 10:00:23 GMT
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.resourceresolver-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git

commit a2175a445839abad2d5c27edea25868b4dfada19
Author: Carsten Ziegeler <cziegeler@apache.org>
AuthorDate: Mon Dec 3 13:57:01 2012 +0000

    SLING-2691 :  Correctly update mapping if a jcr:content node is removed
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/resourceresolver@1416522
13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/resourceresolver/impl/mapping/MapEntries.java    | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
b/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
index 1c22135..7a5ff94 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
@@ -360,15 +360,21 @@ public class MapEntries implements EventHandler {
         // check whether a remove event has an influence on vanity paths
         boolean doInit = true;
         if (SlingConstants.TOPIC_RESOURCE_REMOVED.equals(event.getTopic()) && !path.startsWith(this.mapRoot))
{
+            final String checkPath;
+            if ( path.endsWith("/jcr:content") ) {
+                checkPath = path.substring(0, path.length() - 12);
+            } else {
+                checkPath = path;
+            }
             doInit = false;
             for (final String target : this.vanityTargets) {
-                if (target.startsWith(path)) {
+                if (target.startsWith(checkPath)) {
                     doInit = true;
                     break;
                 }
             }
             for (final String target : this.aliasMap.keySet()) {
-                if (target.startsWith(path)) {
+                if (target.startsWith(checkPath)) {
                     doInit = true;
                     break;
                 }
@@ -747,7 +753,7 @@ public class MapEntries implements EventHandler {
                         PROP_REDIRECT_EXTERNAL_REDIRECT_STATUS, PROP_REDIRECT_EXTERNAL,
                         ResourceResolverImpl.PROP_REDIRECT_INTERNAL, PROP_REDIRECT_EXTERNAL_STATUS,
                         PROP_REG_EXP, ResourceResolverImpl.PROP_ALIAS };
-        final String[] eventProps = { "resourceAddedAttributes", "resourceChangedAttributes",
"resourceRemovedAttributes" };
+        final String[] eventProps = { SlingConstants.PROPERTY_ADDED_ATTRIBUTES, SlingConstants.PROPERTY_CHANGED_ATTRIBUTES,
SlingConstants.PROPERTY_REMOVED_ATTRIBUTES };
         final StringBuilder filter = new StringBuilder();
         filter.append("(|");
         for (final String eventProp : eventProps) {
@@ -757,7 +763,7 @@ public class MapEntries implements EventHandler {
             }
             filter.append(")");
         }
-        filter.append("(" + EventConstants.EVENT_TOPIC + "=" + SlingConstants.TOPIC_RESOURCE_REMOVED
+ ")");
+        filter.append("(").append(EventConstants.EVENT_TOPIC).append("=").append(SlingConstants.TOPIC_RESOURCE_REMOVED).append(")");
         filter.append(")");
 
         return filter.toString();

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Mime
View raw message