if(log.isDebugEnabled()) { log.error("CSMARTUL can't add results to collection: " + e);
if(log.isErrorEnabled()) { log.error("CSMARTUL can't add results to collection: ", e);
  private static Collection getObjectsFromServletWorker(Vector agentURLs,                                            String servletName,                                            ArrayList parameterNames,                                            ArrayList parameterValues,                                            int limit) {    Logger log = CSMART.createLogger("org.cougaar.tools.csmart.ui.monitor.viewer.CSMARTUL");    ServletResult servletResult =      ClientServletUtil.getCollectionFromAgents(agentURLs, servletName,                                                parameterNames,                                                 parameterValues, limit);    ArrayList collections = servletResult.getCollections();    int nAgents = 0;    StringBuffer buf = new StringBuffer(100);    Collection objectsFromServlet = null;    // there is a collection for each agent contacted    // if there was an error contacting the agent, then the collection is null    // if the limit was exceeded, the number of collections is less    // than the number of agents    for (int i = 0; i < collections.size(); i++) {      Collection col = (Collection)collections.get(i);      if (col != null) {        nAgents++;        if (objectsFromServlet == null)          objectsFromServlet = col;        else {          try {            objectsFromServlet.addAll(col);          } catch (Exception e) {            if(log.isDebugEnabled()) {              log.error("CSMARTUL can't add results to collection: " + e);            }          }        }      } else { // these are the agents we couldn't contact        buf.append("\n");        buf.append(agentURLs.get(i));      }    }    if (servletResult.isLimitExceeded())      JOptionPane.showMessageDialog(null,             "Exceeded limit, producing a trimmed graph from " + nAgents +                                    " agents.");    else if (buf.length() != 0)       JOptionPane.showMessageDialog(null,                                    "Failed to contact servlet: " +                                    servletName + " at agents:" +                                    buf.toString());    return objectsFromServlet;  }