trial.addTrialResult(new TrialResult(new Date(), url));
trial.addTrialResult(new TrialResult(runStart, url));
  private void saveResults() {    if (currentTrial < 0)      return; // nothing to save    File resultDir = getResultDir();    if (resultDir == null)      return; // can't save, user didn't specify metrics directory    Trial trial = experiment.getTrials()[currentTrial];    String dirname = resultDir.getAbsolutePath() + File.separatorChar +       experiment.getExperimentName() + File.separatorChar +      trial.getShortName() + File.separatorChar +      "Results-" + fileDateFormat.format(new Date());    try {      File f = new File(dirname);      // guarantee that directories exist      if (!f.mkdirs()) {	System.out.println("CSMARTConsole: Could not save results in: " +			   dirname);	return;      }      String myHostName = InetAddress.getLocalHost().getHostName();      URL url = new URL("file", myHostName, dirname);      trial.addTrialResult(new TrialResult(new Date(), url));    } catch (Exception e) {      System.out.println("Exception creating trial results URL: " + e);      e.printStackTrace();    }    HostComponent[] hosts = experiment.getHosts();    for (int i = 0; i < hosts.length; i++) {      String hostName = hosts[i].getShortName();      HostServesClient hostInfo = null;      try {	hostInfo = communitySupport.getHost(hostName, DEFAULT_PORT);      } catch (java.rmi.UnknownHostException uhe) {	JOptionPane.showMessageDialog(this,				      "Unknown host: " + hostName,				      "Unknown Host",				      JOptionPane.WARNING_MESSAGE);	continue;      } catch (Exception e) {	// This happens if you listed random hosts which you don't	// really intend to talk to	JOptionPane.showMessageDialog(this,				      "No response from host: " + hostName +				      "; check that server is running.",				      "No Response From Server",				      JOptionPane.WARNING_MESSAGE);	continue;      }      copyResultFiles(hostInfo, dirname);    }  }