Program: 73389
Project: 73389
Buggy source:
/** 
 * Save the currently opened search criteria to a new location.
 */
protected void _saveAs(){
  try {
    _searchCriteria=new SearchCriteria();
    if (!_attributesListPanel.getModelName().trim().isEmpty()) {
      _searchCriteria.setModelName(_attributesListPanel.getModelName());
    }
    if (_attributesListPanel.getAttributeCount() > 0) {
      ArrayList<Attribute> attributesToSearch=_attributesListPanel.getAttributes();
      _searchCriteria.setAttributes(attributesToSearch);
    }
    if (_patternMatchframe != null && !_patternMatchframe.isPatternEmpty()) {
      _searchCriteria.setPattnerMoML(_patternMatchframe.getPatternMoML());
    }
    JFileChooser chooser=new JFileChooser();
    FileFilter filter=new SearchCriteriaFileFilter("String_Node_Str");
    chooser.setFileFilter(filter);
    chooser.setDialogTitle("String_Node_Str");
    if (_saveLocation != null) {
      chooser.setSelectedFile(new File(_saveLocation));
    }
    boolean saveComplete=false;
    while (!saveComplete) {
      if (chooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) {
        return;
      }
 else {
        File filename=chooser.getSelectedFile();
        String name=filename.getName();
        if (!name.endsWith("String_Node_Str")) {
          filename=new File(filename.getParent(),name + "String_Node_Str");
        }
        if (filename.exists() && !filename.getCanonicalFile().toString().equals(_saveLocation)) {
          Object[] options={"String_Node_Str","String_Node_Str"};
          int n=JOptionPane.showOptionDialog(this,filename.toString() + "String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[1]);
          if (n == JOptionPane.YES_OPTION) {
            saveComplete=true;
          }
 else {
            saveComplete=false;
          }
        }
 else {
          saveComplete=true;
        }
        if (saveComplete) {
          try {
            SearchCriteriaManager.save(_searchCriteria,filename.getCanonicalPath().toString());
            _saveLocation=chooser.getSelectedFile().getCanonicalPath();
            setModified(false);
            JOptionPane.showMessageDialog(this,"String_Node_Str");
          }
 catch (          IllegalActionException e) {
            MessageHandler.error("String_Node_Str",e);
          }
catch (          IOException e) {
            MessageHandler.error("String_Node_Str",e);
          }
        }
      }
    }
  }
 catch (  IOException e) {
    MessageHandler.error("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    MessageHandler.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Save the currently opened search criteria to a new location.
 */
protected void _saveAs(){
  try {
    _searchCriteria=new SearchCriteria();
    if (!_attributesListPanel.getModelName().trim().isEmpty()) {
      _searchCriteria.setModelName(_attributesListPanel.getModelName());
    }
    if (_attributesListPanel.getAttributeCount() > 0) {
      ArrayList<Attribute> attributesToSearch=_attributesListPanel.getAttributes();
      _searchCriteria.setAttributes(attributesToSearch);
    }
    if (_patternMatchframe != null && !_patternMatchframe.isPatternEmpty()) {
      _searchCriteria.setPattnerMoML(_patternMatchframe.getPatternMoML());
    }
    JFileChooser chooser=new JFileChooser();
    FileFilter filter=new SearchCriteriaFileFilter("String_Node_Str");
    chooser.setFileFilter(filter);
    chooser.setDialogTitle("String_Node_Str");
    if (_saveLocation != null) {
      chooser.setSelectedFile(new File(_saveLocation));
    }
    boolean saveComplete=false;
    while (!saveComplete) {
      if (chooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) {
        return;
      }
 else {
        File filename=chooser.getSelectedFile();
        String name=filename.getName();
        if (!name.endsWith("String_Node_Str")) {
          filename=new File(filename.getParent(),name + "String_Node_Str");
        }
        if (filename.exists() && !filename.getCanonicalFile().toString().equals(_saveLocation)) {
          Object[] options={"String_Node_Str","String_Node_Str"};
          int n=JOptionPane.showOptionDialog(this,filename.toString() + "String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[1]);
          if (n == JOptionPane.YES_OPTION) {
            saveComplete=true;
          }
 else {
            saveComplete=false;
          }
        }
 else {
          saveComplete=true;
        }
        if (saveComplete) {
          try {
            SearchCriteriaManager.save(_searchCriteria,filename.getCanonicalPath());
            _saveLocation=chooser.getSelectedFile().getCanonicalPath();
            setModified(false);
            JOptionPane.showMessageDialog(this,"String_Node_Str");
          }
 catch (          IllegalActionException e) {
            MessageHandler.error("String_Node_Str",e);
          }
catch (          IOException e) {
            MessageHandler.error("String_Node_Str",e);
          }
        }
      }
    }
  }
 catch (  IOException e) {
    MessageHandler.error("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    MessageHandler.error("String_Node_Str",e);
  }
}