jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1161059 - /jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
Date Wed, 24 Aug 2011 11:53:06 GMT
Author: mduerig
Date: Wed Aug 24 11:53:06 2011
New Revision: 1161059

URL: http://svn.apache.org/viewvc?rev=1161059&view=rev
Log:
JCR-3049: NPE in ConsolidatingChangeLog for id base NodeId

Modified:
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java?rev=1161059&r1=1161058&r2=1161059&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
Wed Aug 24 11:53:06 2011
@@ -54,13 +54,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 absolute: " + parent);
+            return null;
         }
 
         return PATH_FACTORY.create(parent, name, true);
@@ -69,7 +70,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 +368,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 +382,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