if(log.isDebugEnabled()) { log.error("CSMARTGraph: Could not write to file:" + dotPathname + " security exception: " + se);
if(log.isErrorEnabled()) { log.error("CSMARTGraph: Could not write to file:" + dotPathname + " security exception: ", se);
  public void doLayout() {    if(log.isDebugEnabled()) {      log.info("CSMARTGraph: Starting layout...");    }    // if we have a mapping of UIDs to nodes then we can minimize the    // information sent to the layout engine    boolean minimizeGraph = true;    if (UIDToNode.size() == 0)      minimizeGraph = false;    // write the graph to a dot file    String dotPathname = System.getProperty("org.cougaar.install.path");    // use static dotFileName    if (dotPathname != null)      dotPathname = dotPathname + File.separatorChar + dotFileName;    else      dotPathname = dotFileName;    // Create a file handle for the dot file    // This will be used later to get the size of the file    File dotFile = null;    try {      dotFile = new File(dotPathname);    } catch (NullPointerException e) {      if(log.isDebugEnabled()) {        log.error("CSMARTGraph: Could not open file handle for " + dotPathname);      }    }        // before writing the graph, save the edges in a hash table    // so that we can merge the results of the layout engine    // note that the nodes were saved in a hash table at creation    if (minimizeGraph) {      UIDToEdge = new Hashtable();      Vector edges = vectorOfElements(GrappaConstants.EDGE);      for (int i = 0; i < edges.size(); i++) {	Edge edge = (Edge)edges.elementAt(i);	UIDToEdge.put(edge.getTail().getName() + edge.getHead().getName(), edge);      }    }    FileOutputStream fos = null;    if(log.isDebugEnabled()) {      log.debug("CSMARTGraph: Writing: " + dotPathname +                " at: " + System.currentTimeMillis()/1000);    }    try {      fos = new FileOutputStream(dotFile); //AMH - use the File handle      PrintWriter pw = new PrintWriter(fos);      // default is to only write attributes required for layout      if (!minimizeGraph)	Grappa.usePrintList = false;      printGraph(pw);      if (!minimizeGraph)	Grappa.usePrintList = true; // reset      pw.close(); // AMH - close it to flush the data, garbage collect    } catch (FileNotFoundException e) {      if(log.isDebugEnabled()) {        log.error("CSMARTGraph: Could not write to file:" + dotPathname + " file not found exception: " + e);      }    } catch (SecurityException se) {      if(log.isDebugEnabled()) {        log.error("CSMARTGraph: Could not write to file:" + dotPathname + " security exception: " + se);      }    } catch (IOException ie) {      if(log.isDebugEnabled()) {        log.error("CSMARTGraph: Could not write to file:" + dotPathname + " I/O exception: " + ie);      }    }    if(log.isDebugEnabled()) {      log.debug("Finished writing: " + dotPathname +                 " at: " + System.currentTimeMillis()/1000);    }    // Now run dot.exe on the dot file    // Take the output of dot.exe, and run it through the parser    // Then build the resulting graph, with buildShapes();    layoutDotFile(dotPathname, minimizeGraph);        // hide nodes and edges with the INVISIBLE_ATTRIBUTE set to true    hideInvisibleElements();  } // end of doLayout()