incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1376417 - /sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
Date Thu, 23 Aug 2012 09:10:30 GMT
Author: cziegeler
Date: Thu Aug 23 09:10:30 2012
New Revision: 1376417

URL: http://svn.apache.org/viewvc?rev=1376417&view=rev
Log:
SLING-2574 : JCR Resource Listener might report false remove events

Modified:
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java?rev=1376417&r1=1376416&r2=1376417&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
Thu Aug 23 09:10:30 2012
@@ -360,10 +360,10 @@ public class JcrResourceListener impleme
                 final EventAdmin localEa = this.eventAdmin;
                 if (localEa != null) {
                     final String topic = (String) event.remove(EventConstants.EVENT_TOPIC);
+                    final String path = (String) event.get(SlingConstants.PROPERTY_PATH);
+                    Resource resource = this.resourceResolver.getResource(path);
                     boolean sendEvent = true;
                     if (!SlingConstants.TOPIC_RESOURCE_REMOVED.equals(topic)) {
-                        final String path = (String) event.get(SlingConstants.PROPERTY_PATH);
-                        Resource resource = this.resourceResolver.getResource(path);
                         if (resource != null) {
                             // check if this is a JCR backed resource, otherwise it is not
visible!
                             final Node node = resource.adaptTo(Node.class);
@@ -404,6 +404,11 @@ public class JcrResourceListener impleme
                                 path);
                             sendEvent = false;
                         }
+                    } else {
+                        // check if the resource is still available - if so the node was
not visible!
+                        if ( resource != null ) {
+                            sendEvent = false;
+                        }
                     }
 
                     if ( sendEvent ) {



Mime
View raw message