geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r1001163 - /geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
Date Sat, 25 Sep 2010 08:20:41 GMT
Author: genspring
Date: Sat Sep 25 08:20:41 2010
New Revision: 1001163

URL: http://svn.apache.org/viewvc?rev=1001163&view=rev
Log:
json string format is incorrect when there's no valid node in the tree.

Modified:
    geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java

Modified: geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java?rev=1001163&r1=1001162&r2=1001163&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
(original)
+++ geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
Sat Sep 25 08:20:41 2010
@@ -110,6 +110,8 @@ public class NavigationJsonGenerator {
         
         if(!isTreeAList){
             
+            
+            boolean hasTopNode=false;
             for (TreeNode node : navigationTree.values()) {
 
                 // when menu items number is less than 6, let's only display the basic menu
to the user.
@@ -118,28 +120,36 @@ public class NavigationJsonGenerator {
                     if (node.isTopNode()) {
                         sb.append("\n");
                         appendNodeToTreeJSON(sb, node, contextPath, DefaultIcon);
+                        hasTopNode=true;
                     }
 
 
             }
             
             //remove the extra ','
+            if(hasTopNode){
             sb.deleteCharAt(sb.length()-1);
+            }
 
             sb.append("\n]");
             
         } else {
             
+            boolean hasLeafNode=false;
             for (TreeNode node : navigationTree.values()) {
                 if (node.isLeafNode()) {
     
                     sb.append("\n");
     
                     appendBasicListJSON(sb, node, contextPath, DefaultIcon);
+                    
+                    hasLeafNode=true;
                 } 
             }
             //remove the extra ','
+            if(hasLeafNode){
             sb.deleteCharAt(sb.length()-1);
+            }
             
             sb.append("\n]");
             



Mime
View raw message