jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
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 GMT
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();



Mime
View raw message