Return-Path: X-Original-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD919DFDD for ; Thu, 26 Jul 2012 13:26:28 +0000 (UTC) Received: (qmail 34677 invoked by uid 500); 26 Jul 2012 13:22:26 -0000 Delivered-To: apmail-jackrabbit-oak-commits-archive@jackrabbit.apache.org Received: (qmail 21555 invoked by uid 500); 26 Jul 2012 13:20:36 -0000 Mailing-List: contact oak-commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-commits@jackrabbit.apache.org Delivered-To: mailing list oak-commits@jackrabbit.apache.org Received: (qmail 10195 invoked by uid 99); 26 Jul 2012 10:40:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jul 2012 10:40:01 +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; Thu, 26 Jul 2012 10:39:59 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2720A23888FD; Thu, 26 Jul 2012 10:39:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1365940 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStateBuilder.java Date: Thu, 26 Jul 2012 10:39:16 -0000 To: oak-commits@jackrabbit.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120726103916.2720A23888FD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jukka Date: Thu Jul 26 10:39:15 2012 New Revision: 1365940 URL: http://svn.apache.org/viewvc?rev=1365940&view=rev Log: OAK-167: Caching NodeStore implementation Throw IllegalStateException when trying to access a builder for a node that has meanwhile been removed. Kudos to Michi for the idea. Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStateBuilder.java Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStateBuilder.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStateBuilder.java?rev=1365940&r1=1365939&r2=1365940&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStateBuilder.java (original) +++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStateBuilder.java Thu Jul 26 10:39:15 2012 @@ -134,7 +134,9 @@ public class MemoryNodeStateBuilder impl if (pstate != null) { MutableNodeState mstate = pstate.nodes.get(name); if (mstate == null && pstate.nodes.containsKey(name)) { - mstate = new MutableNodeState(NULL_STATE); + throw new IllegalStateException( + "This builder refers to a node that has" + + " been removed from it's parent."); } if (mstate != null) { parent = null; @@ -153,11 +155,12 @@ public class MemoryNodeStateBuilder impl MutableNodeState mstate = pstate.nodes.get(name); if (mstate == null) { if (pstate.nodes.containsKey(name)) { - mstate = new MutableNodeState(NULL_STATE); - } else { - mstate = new MutableNodeState(readState); - pstate.nodes.put(name, mstate); + throw new IllegalStateException( + "This builder refers to a node that has" + + " been removed from it's parent."); } + mstate = new MutableNodeState(readState); + pstate.nodes.put(name, mstate); } parent = null; name = null;