From commits-return-11600-apmail-jackrabbit-commits-archive=jackrabbit.apache.org@jackrabbit.apache.org Fri Aug 12 09:40:59 2011 Return-Path: X-Original-To: apmail-jackrabbit-commits-archive@www.apache.org Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8A93E8158 for ; Fri, 12 Aug 2011 09:40:59 +0000 (UTC) Received: (qmail 46194 invoked by uid 500); 12 Aug 2011 09:40:59 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 46072 invoked by uid 500); 12 Aug 2011 09:40:48 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 46059 invoked by uid 99); 12 Aug 2011 09:40:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2011 09:40:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2011 09:40:44 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 404202388903; Fri, 12 Aug 2011 09:40:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1157025 - /jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java Date: Fri, 12 Aug 2011 09:40:25 -0000 To: commits@jackrabbit.apache.org From: mduerig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110812094025.404202388903@eris.apache.org> Author: mduerig Date: Fri Aug 12 09:40:24 2011 New Revision: 1157025 URL: http://svn.apache.org/viewvc?rev=1157025&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=1157025&r1=1157024&r2=1157025&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 Fri Aug 12 09:40:24 2011 @@ -73,7 +73,7 @@ public class ConsolidatingChangeLog exte */ protected static Path getPath(ItemId itemId) { Path path = itemId.getPath(); - if (!path.isAbsolute()) { + if (path != null && !path.isAbsolute()) { throw new IllegalArgumentException("Path not absoulte: " + path); } return path; @@ -298,6 +298,9 @@ public class ConsolidatingChangeLog exte if (other instanceof Remove) { Path thisPath = ConsolidatingChangeLog.getPath(parentId, nodeName); Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId); + if (thisPath == null || otherPath == null) { + return CANCEL_NONE; + } if (thisPath.equals(otherPath)) { return CANCEL_BOTH; } @@ -509,6 +512,9 @@ public class ConsolidatingChangeLog exte if (other instanceof Remove) { Path thisPath = ConsolidatingChangeLog.getPath(srcNodeId); Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId); + if (thisPath == null || otherPath == null) { + return CANCEL_NONE; + } return thisPath.isDescendantOf(otherPath) || thisPath.equals(otherPath) ? CANCEL_THIS : CANCEL_NONE; @@ -516,6 +522,9 @@ public class ConsolidatingChangeLog exte if (other instanceof ReorderNodes) { Path thisPath = ConsolidatingChangeLog.getPath(parentId); Path otherPath = ConsolidatingChangeLog.getPath(((ReorderNodes) other).parentId); + if (thisPath == null || otherPath == null) { + return CANCEL_NONE; + } return thisPath.equals(otherPath) && !hasSNS(srcNodeId) && !hasSNS(beforeNodeId) ? CANCEL_THIS : CANCEL_NONE; @@ -524,7 +533,12 @@ public class ConsolidatingChangeLog exte } private boolean hasSNS(NodeId nodeId) { - return nodeId != null && ConsolidatingChangeLog.getPath(nodeId).getIndex() > 1; + if (nodeId != null) { + Path path = ConsolidatingChangeLog.getPath(nodeId); + return path != null && path.getIndex() > 1; + } + + return false; } } @@ -569,6 +583,9 @@ public class ConsolidatingChangeLog exte if (other instanceof Remove) { Path thisPath = ConsolidatingChangeLog.getPath(nodeId); Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId); + if (thisPath == null || otherPath == null) { + return CANCEL_NONE; + } return thisPath.isDescendantOf(otherPath) || thisPath.equals(otherPath) ? CANCEL_THIS : CANCEL_NONE; @@ -578,6 +595,9 @@ public class ConsolidatingChangeLog exte if (mixinNodeTypeNames.length == setMixin.mixinNodeTypeNames.length) { Path thisPath = ConsolidatingChangeLog.getPath(nodeId); Path otherPath = ConsolidatingChangeLog.getPath(setMixin.nodeId); + if (thisPath == null || otherPath == null) { + return CANCEL_NONE; + } if (thisPath.equals(otherPath)) { for (int k = 0; k < mixinNodeTypeNames.length; k++) { if (!mixinNodeTypeNames[k].equals(setMixin.mixinNodeTypeNames[k])) { @@ -632,6 +652,9 @@ public class ConsolidatingChangeLog exte if (other instanceof Remove) { Path thisPath = ConsolidatingChangeLog.getPath(nodeId); Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId); + if (thisPath == null || otherPath == null) { + return CANCEL_NONE; + } return thisPath.isDescendantOf(otherPath) || thisPath.equals(otherPath) ? CANCEL_THIS : CANCEL_NONE; @@ -641,6 +664,9 @@ public class ConsolidatingChangeLog exte if (primaryTypeName.equals(setPrimaryType.primaryTypeName)) { Path thisPath = ConsolidatingChangeLog.getPath(nodeId); Path otherPath = ConsolidatingChangeLog.getPath(setPrimaryType.nodeId); + if (thisPath == null || otherPath == null) { + return CANCEL_NONE; + } if (thisPath.equals(otherPath)) { return CANCEL_THIS; } @@ -693,6 +719,9 @@ public class ConsolidatingChangeLog exte if (other instanceof Remove) { Path thisPath = ConsolidatingChangeLog.getPath(propertyId); Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId); + if (thisPath == null || otherPath == null) { + return CANCEL_NONE; + } return thisPath.isDescendantOf(otherPath) || thisPath.equals(otherPath) ? CANCEL_THIS : CANCEL_NONE; @@ -700,6 +729,9 @@ public class ConsolidatingChangeLog exte if (other instanceof SetValue) { Path thisPath = ConsolidatingChangeLog.getPath(propertyId); Path otherPath = ConsolidatingChangeLog.getPath(((SetValue) other).propertyId); + if (thisPath == null || otherPath == null) { + return CANCEL_NONE; + } if (thisPath.equals(otherPath)) { return CANCEL_THIS; }