jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1496826 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/
Date Wed, 26 Jun 2013 08:27:58 GMT
Author: mduerig
Date: Wed Jun 26 08:27:57 2013
New Revision: 1496826

URL: http://svn.apache.org/r1496826
Log:
OAK-880: ChangeProcessor causes IllegalArgumentException when path filter ends with a slash
convert jcr path to oak path in EventGeneratingNodeStateDiff and EventFilter

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeProcessor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventFilter.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeProcessor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeProcessor.java?rev=1496826&r1=1496825&r2=1496826&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeProcessor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeProcessor.java
Wed Jun 26 08:27:57 2013
@@ -181,8 +181,8 @@ class ChangeProcessor implements Runnabl
             while (!stopping && changes != null) {
                 EventFilter filter = filterRef.get();
                 if (!(filter.excludeLocal() && changes.isLocal(observationManager.getContentSession())))
{
-                    EventGeneratingNodeStateDiff diff = new EventGeneratingNodeStateDiff(changes);
                     String path = namePathMapper.getOakPath(filter.getPath());
+                    EventGeneratingNodeStateDiff diff = new EventGeneratingNodeStateDiff(changes,
path);
                     changes.diff(VisibleDiff.wrap(diff), path);
                     if (!stopping) {
                         diff.sendEvents();
@@ -229,9 +229,9 @@ class ChangeProcessor implements Runnabl
             this.name = name;
         }
 
-        public EventGeneratingNodeStateDiff(ChangeSet changes) {
+        public EventGeneratingNodeStateDiff(ChangeSet changes, String path) {
             // michid parent nodes should be the root here
-            this(changes, filterRef.get().getPath(), new ArrayList<Iterator<Event>>(PURGE_LIMIT),
null, null, null, "");
+            this(changes, path, new ArrayList<Iterator<Event>>(PURGE_LIMIT),
null, null, null, "");
         }
 
         public void sendEvents() {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventFilter.java?rev=1496826&r1=1496825&r2=1496826&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventFilter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventFilter.java
Wed Jun 26 08:27:57 2013
@@ -139,13 +139,14 @@ class EventFilter {
     }
 
     private boolean include(String path) {
-        boolean equalPaths = this.path.equals(path);
+        String thisOakPath = namePathMapper.getOakPath(this.path);
+        String thatOakPath = namePathMapper.getOakPath(path);
+
+        boolean equalPaths = thisOakPath.equals(thatOakPath);
         if (!deep && !equalPaths) {
             return false;
         }
 
-        String thisOakPath = namePathMapper.getOakPath(this.path);
-        String thatOakPath = namePathMapper.getOakPath(path);
         if (deep && !(PathUtils.isAncestor(thisOakPath, thatOakPath) || equalPaths))
{
             return false;
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java?rev=1496826&r1=1496825&r2=1496826&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java
Wed Jun 26 08:27:57 2013
@@ -58,7 +58,6 @@ import org.apache.jackrabbit.oak.commons
 import org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class ObservationTest extends AbstractRepositoryTest {
@@ -198,7 +197,6 @@ public class ObservationTest extends Abs
     }
 
     @Test
-    @Ignore("OAK-880")
     public void pathFilterWithTrailingSlash() throws Exception {
         final String path = "/events/only/here";
         ExpectationListener listener = new ExpectationListener();



Mime
View raw message