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 58B7036DC for ; Fri, 6 May 2011 05:28:27 +0000 (UTC) Received: (qmail 92198 invoked by uid 500); 6 May 2011 05:28:26 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 92109 invoked by uid 500); 6 May 2011 05:28:25 -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 92098 invoked by uid 99); 6 May 2011 05:28:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2011 05:28:24 +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, 06 May 2011 05:28:22 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 843EC23888CF; Fri, 6 May 2011 05:28:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1100064 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java Date: Fri, 06 May 2011 05:28:02 -0000 To: commits@jackrabbit.apache.org From: thomasm@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110506052802.843EC23888CF@eris.apache.org> Author: thomasm Date: Fri May 6 05:28:02 2011 New Revision: 1100064 URL: http://svn.apache.org/viewvc?rev=1100064&view=rev Log: JCR-2961: Improve logging of Session.save() to trace back root cause of externally modified nodes - workaround for the NullPointerException Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java?rev=1100064&r1=1100063&r2=1100064&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java Fri May 6 05:28:02 2011 @@ -46,12 +46,19 @@ public class SessionSaveOperation implem id = context.getItemStateManager().getIdOfRootTransientNodeState(); } if (LOG.isDebugEnabled()) { - NodeId transientRoot = context.getItemStateManager().getIdOfRootTransientNodeState(); - ItemImpl item = context.getItemManager().getItem(transientRoot); + String path; + try { + NodeId transientRoot = context.getItemStateManager().getIdOfRootTransientNodeState(); + ItemImpl item = context.getItemManager().getItem(transientRoot); + path = item.getPath(); + } catch (Exception e) { + LOG.warn("Could not get the path", e); + path = "?"; + } if (LOG_WITH_STACKTRACE) { - LOG.debug("Saving changes under " + item.getPath(), new Exception()); + LOG.debug("Saving changes under " + path, new Exception()); } else { - LOG.debug("Saving changes under " + item.getPath()); + LOG.debug("Saving changes under " + path); } } context.getItemManager().getItem(id).save();