You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2016/11/14 11:46:11 UTC
svn commit: r1769605 -
/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/observation/BasicObservationReporter.java
Author: cziegeler
Date: Mon Nov 14 11:46:11 2016
New Revision: 1769605
URL: http://svn.apache.org/viewvc?rev=1769605&view=rev
Log:
SLING-6283 : Exclusion of observations with listeners using patterns is too aggressive
Modified:
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/observation/BasicObservationReporter.java
Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/observation/BasicObservationReporter.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/observation/BasicObservationReporter.java?rev=1769605&r1=1769604&r2=1769605&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/observation/BasicObservationReporter.java (original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/observation/BasicObservationReporter.java Mon Nov 14 11:46:11 2016
@@ -96,7 +96,25 @@ public class BasicObservationReporter im
// find the set of paths that match the provider
final Set<Path> paths = new HashSet<>();
for(final Path p : info.getPaths()) {
- if ( providerPath.matches(p.getPath()) && excludePaths.matches(p.getPath()) == null ) {
+ boolean add = providerPath.matches(p.getPath());
+ if ( add ) {
+ if ( p.isPattern() ) {
+ for(final Path exclude : excludePaths) {
+ if ( p.getPath().startsWith(Path.GLOB_PREFIX + exclude.getPath() + "/")) {
+ logger.debug("ResourceChangeListener {} is shadowed by {}", info, exclude);
+ add = false;
+ break;
+ }
+ }
+ } else {
+ final Path exclude = excludePaths.matches(p.getPath());
+ if ( exclude != null ) {
+ logger.debug("ResourceChangeListener {} is shadowed by {}", info, exclude);
+ add = false;
+ }
+ }
+ }
+ if ( add ) {
paths.add(p);
}
}