jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1463939 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state: AbstractChildNodeEntry.java AbstractNodeState.java
Date Wed, 03 Apr 2013 11:58:19 GMT
Author: jukka
Date: Wed Apr  3 11:58:19 2013
New Revision: 1463939

URL: http://svn.apache.org/r1463939
Log:
Improved AbstractNodeState.toString() to help debugging.

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractChildNodeEntry.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractChildNodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractChildNodeEntry.java?rev=1463939&r1=1463938&r2=1463939&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractChildNodeEntry.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractChildNodeEntry.java
Wed Apr  3 11:58:19 2013
@@ -31,7 +31,13 @@ public abstract class AbstractChildNodeE
      */
     @Override
     public String toString() {
-        return getName();
+        String name = getName();
+        NodeState state = getNodeState();
+        if (state.getChildNodeCount() == 0) {
+            return name + " = " + state;
+        } else {
+            return name + " = { ... }";
+        }
     }
 
     /**

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java?rev=1463939&r1=1463938&r2=1463939&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
Wed Apr  3 11:58:19 2013
@@ -21,7 +21,6 @@ import static com.google.common.base.Pre
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import com.google.common.base.Function;
 import com.google.common.collect.Iterables;
@@ -127,18 +126,16 @@ public abstract class AbstractNodeState 
      */
     public String toString() {
         StringBuilder builder = new StringBuilder("{");
-        AtomicBoolean first = new AtomicBoolean(true);
+        String separator = " ";
         for (PropertyState property : getProperties()) {
-            if (!first.getAndSet(false)) {
-                builder.append(',');
-            }
-            builder.append(' ').append(property);
+            builder.append(separator);
+            separator = ", ";
+            builder.append(property);
         }
         for (ChildNodeEntry entry : getChildNodeEntries()) {
-            if (!first.getAndSet(false)) {
-                builder.append(',');
-            }
-            builder.append(' ').append(entry);
+            builder.append(separator);
+            separator = ", ";
+            builder.append(entry);
         }
         builder.append(" }");
         return builder.toString();
@@ -184,7 +181,6 @@ public abstract class AbstractNodeState 
         }
 
         return true;
-
     }
 
     /**



Mime
View raw message