jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1126938 - /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
Date Tue, 24 May 2011 08:57:01 GMT
Author: mduerig
Date: Tue May 24 08:57:01 2011
New Revision: 1126938

URL: http://svn.apache.org/viewvc?rev=1126938&view=rev
Log:
MicroKernel prototype (WIP)
add names of child nodes to json tree

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java?rev=1126938&r1=1126937&r2=1126938&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
Tue May 24 08:57:01 2011
@@ -29,7 +29,6 @@ import org.apache.jackrabbit.mk.util.Pat
 import org.json.simple.parser.ContainerFactory;
 import org.json.simple.parser.JSONParser;
 
-import java.awt.geom.PathIterator;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -405,15 +404,19 @@ public class MicroKernelImpl implements 
             buf.append(childCount);
             buf.append(",");
         }
-        if (childCount > 0 && depth > 0) {
-            depth--;
+        if (childCount > 0 && depth >= 0) {
             for (Map.Entry<String, String> child : node.getChildNodeEntries().entrySet())
{
                 buf.append('"');
                 String childName = child.getKey();
                 buf.append(childName);
                 buf.append("\":");
-                String childId = child.getValue();
-                toJson(rep.getStore().getNode(childId), childName, depth, metaProps, buf);
+                if (depth > 0) {
+                    String childId = child.getValue();
+                    toJson(rep.getStore().getNode(childId), childName, depth - 1, metaProps,
buf);
+                }
+                else {
+                    buf.append("{}");
+                }
                 buf.append(',');
             }
         }



Mime
View raw message