if (file != null && (! file.canRead() || file.isDirectory())) file = null;
  public void importHNA(Component parent) {    File resultDir = getResultDirectory();    String path = ".";    if (resultDir != null)      path = resultDir.getAbsolutePath();    JFileChooser chooser = new JFileChooser(path);    chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);    chooser.setFileFilter(new javax.swing.filechooser.FileFilter() {	public boolean accept (File f) {	  return (f.isDirectory() || (f.isFile()) &&             (f.getName().endsWith("xml") || f.getName().endsWith("XML")));	}	public String getDescription() {return "HNA XML Files";}      });    File file = null;    while(file == null) {      int result = chooser.showDialog(parent, "OK");      if(result != JFileChooser.APPROVE_OPTION)        return;      file = chooser.getSelectedFile();    }    if (log.isInfoEnabled()) {      log.info("importing HNA file " + file.getAbsolutePath());    }    // FIXME: Put up a dialog indicating the file being imported?    // Bug 1765    ComponentData mapping = null;    if(file != null) {      ExperimentXML parser = new ExperimentXML();      mapping = parser.parseExperimentFile(file);      if(mapping == null) {        if(log.isErrorEnabled()) {          log.error("Error parsing file: " + file.getName());        }        // Display an error dialog here!        return;      }            if(mapping.getType().equals(ComponentData.SOCIETY)) {        addChildren(mapping.getChildren());      } else {        if(log.isErrorEnabled()) {          log.error("Didn't start with a society!");        }      }    }  }