jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1336725 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: ItemImpl.java NodeDelegate.java NodeImpl.java PropertyDelegate.java PropertyImpl.java util/
Date Thu, 10 May 2012 14:46:36 GMT
Author: mduerig
Date: Thu May 10 14:46:35 2012
New Revision: 1336725

URL: http://svn.apache.org/viewvc?rev=1336725&view=rev
Log:
OAK-97: Implement Item.toString() for logging and debugging purposes

Removed:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/util/
Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java?rev=1336725&r1=1336724&r2=1336725&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
Thu May 10 14:46:35 2012
@@ -65,7 +65,6 @@ abstract class ItemImpl extends Abstract
         return toJcrPath(dlg.getPath());
     }
 
-
     @Override
     public Session getSession() throws RepositoryException {
         return sessionDelegate.getSession();
@@ -127,6 +126,11 @@ abstract class ItemImpl extends Abstract
         getSession().refresh(keepChanges);
     }
 
+    @Override
+    public String toString() {
+        return (isNode() ? "Node[" : "Property[") + dlg + ']';
+    }
+
     //------------------------------------------------------------< internal >---
 
     /**

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java?rev=1336725&r1=1336724&r2=1336725&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
Thu May 10 14:46:35 2012
@@ -86,6 +86,12 @@ public class NodeDelegate extends ItemDe
         return sessionDelegate;
     }
 
+    @Override
+    public String toString() {
+        // don't disturb the state: avoid calling getTree()
+        return "NodeDelegate[/" + tree.getPath() + ']';
+    }
+
     /**
      * Determine whether this is the root node
      * @return  {@code true} iff this is the root node

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1336725&r1=1336724&r2=1336725&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Thu May 10 14:46:35 2012
@@ -22,7 +22,6 @@ import org.apache.jackrabbit.commons.ite
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.Tree.Status;
 import org.apache.jackrabbit.oak.commons.PathUtils;
-import org.apache.jackrabbit.oak.jcr.util.LogUtil;
 import org.apache.jackrabbit.oak.jcr.value.ValueConverter;
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 import org.apache.jackrabbit.oak.util.Function1;
@@ -476,14 +475,14 @@ public class NodeImpl extends ItemImpl i
         checkStatus();
         String name = getPrimaryNodeType().getPrimaryItemName();
         if (name == null) {
-            throw new ItemNotFoundException("No primary item present on node " + LogUtil.safeGetJCRPath(this));
+            throw new ItemNotFoundException("No primary item present on node " + this);
         }
         if (hasProperty(name)) {
             return getProperty(name);
         } else if (hasNode(name)) {
             return getNode(name);
         } else {
-            throw new ItemNotFoundException("Primary item " + name + " does not exist on
node " + LogUtil.safeGetJCRPath(this));
+            throw new ItemNotFoundException("Primary item " + name + " does not exist on
node " + this);
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java?rev=1336725&r1=1336724&r2=1336725&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
Thu May 10 14:46:35 2012
@@ -87,6 +87,12 @@ public class PropertyDelegate extends It
         return sessionDelegate;
     }
 
+    @Override
+    public String toString() {
+        // don't disturb the state: avoid calling resolve()
+        return "PropertyDelegate[/" + parent.getPath() + '/' + propertyState.getName() +
']';
+    }
+
     /**
      * Get the value of the property
      * @return  value or {@code null} if multi values

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java?rev=1336725&r1=1336724&r2=1336725&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
Thu May 10 14:46:35 2012
@@ -17,7 +17,6 @@
 package org.apache.jackrabbit.oak.jcr;
 
 import org.apache.jackrabbit.oak.api.Tree.Status;
-import org.apache.jackrabbit.oak.jcr.util.LogUtil;
 import org.apache.jackrabbit.oak.jcr.value.ValueConverter;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.slf4j.Logger;
@@ -140,7 +139,7 @@ public class PropertyImpl extends ItemIm
                     valueType = value.getType();
                 }
                 else if (valueType != value.getType()) {
-                    String msg = "Inhomogeneous type of values (" + LogUtil.safeGetJCRPath(this)
+ ')';
+                    String msg = "Inhomogeneous type of values (" + this + ')';
                     log.debug(msg);
                     throw new ValueFormatException(msg);
                 }
@@ -300,7 +299,7 @@ public class PropertyImpl extends ItemIm
     public Value getValue() throws RepositoryException {
         checkStatus();
         if (isMultiple()) {
-            throw new ValueFormatException(LogUtil.safeGetJCRPath(this) + " is multi-valued.");
+            throw new ValueFormatException(this + " is multi-valued.");
         }
 
         return ValueConverter.toValue(dlg.getValue(), sessionDelegate);
@@ -310,7 +309,7 @@ public class PropertyImpl extends ItemIm
     public Value[] getValues() throws RepositoryException {
         checkStatus();
         if (!isMultiple()) {
-            throw new ValueFormatException(LogUtil.safeGetJCRPath(this) + " is not multi-valued.");
+            throw new ValueFormatException(this + " is not multi-valued.");
         }
 
         return ValueConverter.toValues(dlg.getValues(), sessionDelegate);



Mime
View raw message