Program: 149543
Project: 149543
Buggy source:
/** 
 * Show a dialog to configure the smart filter. The updated settings are saved to the settings file. <p> If the fit configuration isSmartFilter is not enabled then this method returns true. If it is enabled then a dialog is shown to input the configuration for a smart filter. If no valid filter can be created from the input then the method returns false.
 * @param settings the settings
 * @param filename the filename
 * @return true, if successful
 */
public static boolean configureSmartFilter(GlobalSettings settings,String filename){
  FitEngineConfiguration config=settings.getFitEngineConfiguration();
  FitConfiguration fitConfig=config.getFitConfiguration();
  Calibration calibration=settings.getCalibration();
  if (!fitConfig.isSmartFilter())   return true;
  GenericDialog gd=new GenericDialog(TITLE);
  String xml=fitConfig.getSmartFilterXML();
  if (Utils.isNullOrEmpty(xml))   xml=fitConfig.getDefaultSmartFilterXML();
  gd.addMessage("String_Node_Str");
  gd.addTextAreas(XmlUtils.convertQuotes(xml),null,8,60);
  gd.addMessage("String_Node_Str");
  gd.addNumericField("String_Node_Str",calibration.bias,2);
  gd.showDialog();
  if (gd.wasCanceled())   return false;
  xml=gd.getNextText();
  Filter f=DirectFilter.fromXML(xml);
  if (f == null || !(f instanceof DirectFilter))   return false;
  fitConfig.setDirectFilter((DirectFilter)f);
  calibration.bias=Math.abs(gd.getNextNumber());
  if (filename != null)   SettingsManager.saveSettings(settings,filename);
  return true;
}

Fixed version (ground truth):
/** 
 * Show a dialog to configure the smart filter. The updated settings are saved to the settings file. <p> If the fit configuration isSmartFilter is not enabled then this method returns true. If it is enabled then a dialog is shown to input the configuration for a smart filter. If no valid filter can be created from the input then the method returns false. <p> Note: If the smart filter is successfully configured then the standard fit validation is disabled. 
 * @param settings the settings
 * @param filename the filename
 * @return true, if successful
 */
public static boolean configureSmartFilter(GlobalSettings settings,String filename){
  FitEngineConfiguration config=settings.getFitEngineConfiguration();
  FitConfiguration fitConfig=config.getFitConfiguration();
  Calibration calibration=settings.getCalibration();
  if (!fitConfig.isSmartFilter())   return true;
  GenericDialog gd=new GenericDialog(TITLE);
  String xml=fitConfig.getSmartFilterXML();
  if (Utils.isNullOrEmpty(xml))   xml=fitConfig.getDefaultSmartFilterXML();
  gd.addMessage("String_Node_Str");
  gd.addTextAreas(XmlUtils.convertQuotes(xml),null,8,60);
  gd.addMessage("String_Node_Str");
  gd.addNumericField("String_Node_Str",calibration.bias,2);
  gd.showDialog();
  if (gd.wasCanceled())   return false;
  xml=gd.getNextText();
  Filter f=DirectFilter.fromXML(xml);
  if (f == null || !(f instanceof DirectFilter))   return false;
  fitConfig.setDirectFilter((DirectFilter)f);
  fitConfig.setFitValidation(false);
  calibration.bias=Math.abs(gd.getNextNumber());
  if (filename != null)   SettingsManager.saveSettings(settings,filename);
  return true;
}