Update of 
/var/cvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/struts
In directory 
james.mmbase.org:/tmp/cvs-serv5683/cmsc/utilities/src/java/com/finalist/cmsc/struts

Modified Files:
      Tag: b1_4
        TreeAction.java 
Log Message:
CMSC-1307 - SelectorPage.do stacktraces on non-existing pages; fixed by adding 
a check.


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/struts
See also: http://www.mmbase.org/jira/browse/CMSC-1307


Index: TreeAction.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/struts/TreeAction.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -b -r1.4 -r1.4.2.1
--- TreeAction.java     26 Nov 2007 11:43:41 -0000      1.4
+++ TreeAction.java     25 Feb 2009 13:43:26 -0000      1.4.2.1
@@ -10,14 +10,14 @@
 package com.finalist.cmsc.struts;
 
 import java.io.PrintWriter;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import net.sf.mmapps.commons.util.HttpUtil;
-import net.sf.mmapps.commons.util.StringUtil;
+
+import org.apache.commons.lang.StringUtils;
 
 import org.apache.struts.action.*;
 import org.mmbase.bridge.Cloud;
@@ -36,7 +36,7 @@
       TreeInfo info = getTreeInfo(cloud);
 
       String action = request.getParameter("action");
-      if (!StringUtil.isEmpty(action)) {
+      if (StringUtils.isNotEmpty(action)) {
          response.setContentType("text/xml");
          if ("expand".equals(action)) {
             String persistentid = request.getParameter("persistentid");
@@ -67,22 +67,22 @@
 
             PrintWriter out = HttpUtil.getWriterForXml(response);
             out.write("<options>");
-            for (Iterator<String> iter = children.iterator(); iter.hasNext();) 
{
-               String element = iter.next();
+            for (String element : children) {
                out.write("<option>" + element + "</option>");
             }
             out.write("</options>");
          }
          return null;
       }
-      else {
+
          String channel = getChannelId(request, cloud);
-         if (!StringUtil.isEmpty(channel) && !"notfound".equals(channel)) {
+      if (StringUtils.isNotEmpty(channel) && !"notfound".equals(channel) 
+            && cloud.hasNode(channel)) {
+
             Node channelNode = cloud.getNode(channel);
             List<Node> openChannels = getOpenChannels(channelNode);
             if (openChannels != null) {
-               for (Iterator<Node> iter = openChannels.iterator(); 
iter.hasNext();) {
-                  Node node = iter.next();
+            for (Node node : openChannels) {
                   info.expand(node.getNumber());
                }
                addToRequest(request, "channel", channelNode);
@@ -98,7 +98,6 @@
          ActionForward ret = mapping.findForward(SUCCESS);
          return ret;
       }
-   }
 
 
    protected String getChannelId(HttpServletRequest request, Cloud cloud) {
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to