jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1524982 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
Date Fri, 20 Sep 2013 12:17:51 GMT
Author: mduerig
Date: Fri Sep 20 12:17:51 2013
New Revision: 1524982

URL: http://svn.apache.org/r1524982
Log:
OAK-769: Add utility method to JsopDiff for debugging node states
Prevent dereferencing null in child diffs

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java?rev=1524982&r1=1524981&r2=1524982&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
Fri Sep 20 12:17:51 2013
@@ -87,12 +87,27 @@ public class JsopDiff implements NodeSta
      * @return  jsop diff between {@code before} and {@code after}
      */
     public static String diffToJsop(NodeState before, NodeState after) {
-        JsopDiff diff = new JsopDiff(null) {
+        class ToStringDiff extends JsopDiff {
+            public ToStringDiff() {
+                super(null);
+            }
+
+            public ToStringDiff(JsopBuilder jsop, String path) {
+                super(null, jsop, path);
+            }
+
             @Override
             protected String writeBlob(Blob blob) {
                 return "Blob{" + Arrays.toString(blob.sha256()) + '}';
             }
-        };
+
+            @Override
+            protected JsopDiff createChildDiff(JsopBuilder jsop, String path) {
+                return new ToStringDiff(jsop, path);
+            }
+        }
+
+        JsopDiff diff = new ToStringDiff();
         after.compareAgainstBaseState(before, diff);
         return diff.toString();
     }



Mime
View raw message