Program: 22785
Project: 22785
Buggy source:
/** 
 * Load training data (no GUI)
 * @param pathname complete path name of the training data file (.arff)
 * @return false if error
 */
public boolean loadTrainingData(String pathname){
  IJ.log("String_Node_Str" + pathname + "String_Node_Str");
  loadedTrainingData=readDataFromARFF(pathname);
  Enumeration<Attribute> attributes=loadedTrainingData.enumerateAttributes();
  final int numFeatures=FeatureStack.availableFeatures.length;
  boolean[] usedFeatures=new boolean[numFeatures];
  while (attributes.hasMoreElements()) {
    final Attribute a=attributes.nextElement();
    for (int i=0; i < numFeatures; i++)     if (a.name().startsWith(FeatureStack.availableFeatures[i]))     usedFeatures[i]=true;
  }
  Attribute classAttribute=loadedTrainingData.classAttribute();
  Enumeration<String> classValues=classAttribute.enumerateValues();
  loadedClassNames=new ArrayList<String>();
  int j=0;
  while (classValues.hasMoreElements()) {
    final String className=classValues.nextElement().trim();
    loadedClassNames.add(className);
    IJ.log("String_Node_Str" + className);
    if (!className.equals(this.classLabels[j])) {
      String s=classLabels[0];
      for (int i=1; i < numOfClasses; i++)       s=s.concat("String_Node_Str" + classLabels[i]);
      IJ.error("String_Node_Str" + s);
      loadedTrainingData=null;
      return false;
    }
    j++;
  }
  if (j != numOfClasses) {
    IJ.error("String_Node_Str");
    loadedTrainingData=null;
    return false;
  }
  IJ.log("String_Node_Str" + loadedTrainingData.numInstances() + "String_Node_Str"+ wholeImageData.numAttributes()+ "String_Node_Str");
  boolean featuresChanged=false;
  final boolean[] oldEnableFeatures=this.featureStack.getEnableFeatures();
  for (int i=0; i < numFeatures; i++) {
    if (usedFeatures[i] != oldEnableFeatures[i])     featuresChanged=true;
  }
  if (featuresChanged) {
    this.setButtonsEnabled(false);
    this.featureStack.setEnableFeatures(usedFeatures);
    this.featureStack.updateFeatures();
    this.setButtonsEnabled(true);
    updateWholeData=true;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Load training data (no GUI)
 * @param pathname complete path name of the training data file (.arff)
 * @return false if error
 */
public boolean loadTrainingData(String pathname){
  IJ.log("String_Node_Str" + pathname + "String_Node_Str");
  loadedTrainingData=readDataFromARFF(pathname);
  Enumeration<Attribute> attributes=loadedTrainingData.enumerateAttributes();
  final int numFeatures=FeatureStack.availableFeatures.length;
  boolean[] usedFeatures=new boolean[numFeatures];
  while (attributes.hasMoreElements()) {
    final Attribute a=attributes.nextElement();
    for (int i=0; i < numFeatures; i++)     if (a.name().startsWith(FeatureStack.availableFeatures[i]))     usedFeatures[i]=true;
  }
  Attribute classAttribute=loadedTrainingData.classAttribute();
  Enumeration<String> classValues=classAttribute.enumerateValues();
  loadedClassNames=new ArrayList<String>();
  int j=0;
  while (classValues.hasMoreElements()) {
    final String className=classValues.nextElement().trim();
    loadedClassNames.add(className);
    IJ.log("String_Node_Str" + className);
    if (!className.equals(this.classLabels[j])) {
      String s=classLabels[0];
      for (int i=1; i < numOfClasses; i++)       s=s.concat("String_Node_Str" + classLabels[i]);
      IJ.error("String_Node_Str" + s);
      loadedTrainingData=null;
      return false;
    }
    j++;
  }
  if (j != numOfClasses) {
    IJ.error("String_Node_Str");
    loadedTrainingData=null;
    return false;
  }
  IJ.log("String_Node_Str" + loadedTrainingData.numInstances() + "String_Node_Str"+ loadedTrainingData.numAttributes()+ "String_Node_Str");
  boolean featuresChanged=false;
  final boolean[] oldEnableFeatures=this.featureStack.getEnableFeatures();
  for (int i=0; i < numFeatures; i++) {
    if (usedFeatures[i] != oldEnableFeatures[i])     featuresChanged=true;
  }
  if (featuresChanged) {
    this.setButtonsEnabled(false);
    this.featureStack.setEnableFeatures(usedFeatures);
    this.featureStack.updateFeatures();
    this.setButtonsEnabled(true);
    updateWholeData=true;
  }
  return true;
}