jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1161060 - in /jackrabbit/sandbox/jackrabbit-mk: ./ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
Date Wed, 24 Aug 2011 11:56:04 GMT
Author: mduerig
Date: Wed Aug 24 11:56:04 2011
New Revision: 1161060

URL: http://svn.apache.org/viewvc?rev=1161060&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP)
- merge from trunk

Modified:
    jackrabbit/sandbox/jackrabbit-mk/   (props changed)
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java

Propchange: jackrabbit/sandbox/jackrabbit-mk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 24 11:56:04 2011
@@ -1,2 +1,2 @@
 /jackrabbit/sandbox/JCR-2415-lucene-3.0:1060860-1064038
-/jackrabbit/trunk:1158344-1161029
+/jackrabbit/trunk:1158344-1161059

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java?rev=1161060&r1=1161059&r2=1161060&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
Wed Aug 24 11:56:04 2011
@@ -16,11 +16,6 @@
  */
 package org.apache.jackrabbit.spi.commons.batch;
 
-import java.util.Iterator;
-import java.util.ListIterator;
-
-import javax.jcr.RepositoryException;
-
 import org.apache.jackrabbit.spi.Batch;
 import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.spi.Name;
@@ -31,6 +26,10 @@ import org.apache.jackrabbit.spi.Propert
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
 
+import javax.jcr.RepositoryException;
+import java.util.Iterator;
+import java.util.ListIterator;
+
 /**
  * A {@link ChangeLog} implementation which does basic consolidation on its
  * {@link org.apache.jackrabbit.spi.commons.batch.Operation Operation}s. That is, cancelling
@@ -54,13 +53,14 @@ public class ConsolidatingChangeLog exte
      * child.
      * @param parentId  node id of the parent
      * @param name  name of the child
-     * @return  the path of the item <code>name</code>
+     * @return  the path of the item <code>name</code> or <code>null</code>
if <code>parentId</code>'s
+     * path is not absolute
      * @throws RepositoryException
      */
     protected static Path getPath(NodeId parentId, Name name) throws RepositoryException
{
         Path parent = parentId.getPath();
         if (!parent.isAbsolute()) {
-            throw new IllegalArgumentException("Path not absoulte: " + parent);
+            return null;
         }
 
         return PATH_FACTORY.create(parent, name, true);
@@ -69,7 +69,8 @@ public class ConsolidatingChangeLog exte
     /**
      * Determine the {@link Path} from an {@link ItemId}.
      * @param itemId
-     * @return  path of the item <code>itemId</code>
+     * @return  path of the item <code>itemId</code> or <code>null</code>
if <code>itemId</code>'s
+     * path is not absolute
      */
     protected static Path getPath(ItemId itemId) {
         Path path = itemId.getPath();
@@ -366,6 +367,9 @@ public class ConsolidatingChangeLog exte
                 if (other instanceof Remove) {
                     Path thisPath = ConsolidatingChangeLog.getPath(parentId, propertyName);
                     Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId);
+                    if (thisPath == null || otherPath == null) {
+                        return CANCEL_NONE;
+                    }
                     if (thisPath.equals(otherPath)) {
                         return CANCEL_BOTH;
                     }
@@ -377,6 +381,9 @@ public class ConsolidatingChangeLog exte
                     SetValue setValue = (SetValue) other;
                     Path thisPath = ConsolidatingChangeLog.getPath(parentId, propertyName);
                     Path otherPath = ConsolidatingChangeLog.getPath(setValue.propertyId);
+                    if (thisPath == null || otherPath == null) {
+                        return CANCEL_NONE;
+                    }
                     if (thisPath.equals(otherPath)) {
                         if (!isMultivalued && setValue.values[0] == null) {
                             return CANCEL_BOTH;



Mime
View raw message