sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1583952 - /sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/OakResourceListener.java
Date Wed, 02 Apr 2014 10:06:35 GMT
Author: mduerig
Date: Wed Apr  2 10:06:35 2014
New Revision: 1583952

URL: http://svn.apache.org/r1583952
Log:
SLING-3487: Resource added events missing when using new OakResourceListener
Credits to Marc Pfaff for the patch. Applied with slight modifications

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

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/OakResourceListener.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/OakResourceListener.java?rev=1583952&r1=1583951&r2=1583952&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/OakResourceListener.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/OakResourceListener.java
Wed Apr  2 10:06:35 2014
@@ -181,10 +181,15 @@ public class OakResourceListener extends
                         final ResourceResolver resolver = this.support.getResourceResolver();
                         if ( resolver == null ) {
                             sendEvent = false;
+                            logger.debug("resource resolver is null");
                         } else {
-                            final Resource rsrc = resolver.getResource((String)changes.get(PROPERTY_PATH));
+                            resolver.refresh();
+                            String changesPath = (String)changes.get(PROPERTY_PATH);
+                            final Resource rsrc = resolver.getResource(changesPath);
                             if ( rsrc == null ) {
+                                resolver.refresh();
                                 sendEvent = false;
+                                logger.debug("not able to get resource for changes path {}",
changesPath);
                             } else {
                                 // check if this is a JCR backed resource, otherwise it is
not visible!
                                 final Node node = rsrc.adaptTo(Node.class);
@@ -201,11 +206,13 @@ public class OakResourceListener extends
                                         }
                                     } catch (RepositoryException re) {
                                         // ignore this
+                                        logger.error(re.getMessage(), re);
                                     }
 
                                 } else {
                                     // this is not a jcr backed resource
                                     sendEvent = false;
+                                    logger.debug("not able to adapt resource {} to node",
rsrc.getPath());
                                 }
 
                             }
@@ -213,7 +220,7 @@ public class OakResourceListener extends
                         if ( !sendEvent ) {
                             // take a quite silent note of not being able to
                             // resolve the resource
-                            logger.debug(
+                            logger.warn(
                                 "processOsgiEventQueue: Resource at {} not found, which is
not expected for an added or modified node",
                                     path);
                         }



Mime
View raw message