if (log.isErrorEnabled()) log.error("Exception Encoding ", e);
System.err.println("Exception Encoding: "+e.getMessage());
    private static void replyWithHTML(				      PrintWriter out, 				      ClusterIdentifier cid,				      Set startUIDs,				      boolean isDown,				      List l) {      Logger log = (Logger) NullLoggingServiceImpl.getNullLoggingServiceImpl();      int nStartUIDs = ((startUIDs != null) ? startUIDs.size() : 0);      out.print(		"<html><head><title>Search results</title></head><body>\n"+		"<h2>Search "+cid+"</h2><p>\n"+		"<h3>Direction: <b>"+(isDown ? "Down" : "Up")+"</b></h3>\n"+		"<h3>Start with UIDs["+nStartUIDs+"]:</h3>");      if (nStartUIDs > 0) {	out.print("<ol>");	Iterator iter = startUIDs.iterator();	for (int i = 0; i < nStartUIDs; i++) {	  out.print("<li>"+iter.next()+"</li>");	}	out.print("</ol>");      } else {	out.print(		  "<i>Use \"?uid=...\" or POST a serialized "+		  "List of UID Strings</i>");      }      int n = ((l != null) ? l.size() : 0);      out.print("\n<h3>Found UniqueObjects["+n+"]:</h3><p>"+		"<i>Note: links will appear in the task servlet's lower-left frame</i>"+		"<p><ol>\n");      String hrefBase  = null;      try {        hrefBase =          "<a"+          " target=\"itemFrame\""+          " href=\"/$"+          URLEncoder.encode(cid.toString(), "UTF-8")+          "/tasks?uid=";        } catch(UnsupportedEncodingException e) {          if (log.isErrorEnabled())            log.error("Exception Encoding ", e);        }      // print objs      for (int i = 0; i < n; i++) {	UniqueObject ui = (UniqueObject)l.get(i);	String href;	UID uid = ui.getUID();	if (uid != null) {	  String suid = ui.getUID().toString();	  // mode must match tasks servlet	  int mode =	    ((ui instanceof Task) ? 3 :	     (ui instanceof PlanElement) ? 5 :	     (ui instanceof Asset) ? 7 :	     10);	  href=	    hrefBase+	    suid+	    "?mode="+	    mode+	    "\">"+suid+"</a>";	} else {	  href = "<font color=\"red\">null UID</font>";	}	out.print(		  "\n<li>"+		  href+		  " == "+ui.getClass().getName()+"</li>");      }            out.print(		"\n</ol>\n<h3>As PropertyTrees[");      // convert to PropertyTrees      List retL = TranslateUtils.toPropertyTrees(l, cid.toString());      int nRetL = ((retL != null) ? retL.size() : 0);      out.print(nRetL+"]:</h3><ol>");      for (int i = 0; i < nRetL; i++) {	out.print("\n<li>"+retL.get(i)+"</li>");      }      out.print("\n</ol></body></html>");            out.flush();    }