Program: 92578
Project: 92578
Buggy source:
/** 
 * Parse a dataset from a buffered reader.
 * @param data the dataset.
 * @param reader the buffered reader for data.
 * @throws java.io.IOException
 */
private void parse(AttributeDataset data,BufferedReader reader) throws IOException, ParseException {
  Attribute[] attributes=data.attributes();
  int n=attributes.length;
  if (hasRowNames) {
    n=n + 1;
  }
  if (responseIndex >= 0) {
    n=n + 1;
  }
  String line=null;
  boolean firstLine=true;
  while ((line=reader.readLine()) != null) {
    if (line.isEmpty()) {
      continue;
    }
    if (line.startsWith(comment)) {
      continue;
    }
    String[] s=line.split(delimiter,0);
    if (s.length != n) {
      throw new ParseException(String.format("String_Node_Str",s.length,n),s.length);
    }
    if (hasColumnNames && firstLine) {
      firstLine=false;
      for (int i=hasRowNames ? 1 : 0, k=0; i < s.length; i++) {
        if (i == responseIndex) {
          response.setName(s[i]);
        }
 else {
          attributes[k].setName(s[i]);
          k++;
        }
      }
      continue;
    }
    String rowName=hasRowNames ? s[0] : null;
    double[] x=new double[attributes.length];
    double y=Double.NaN;
    for (int i=hasRowNames ? 1 : 0, k=0; i < s.length; i++) {
      if (i == responseIndex) {
        y=response.valueOf(s[i]);
      }
 else       if (missing != null && missing.equalsIgnoreCase(s[i])) {
        x[k++]=Double.NaN;
      }
 else {
        x[k]=attributes[k].valueOf(s[i]);
        k++;
      }
    }
    Datum<double[]> datum=new Datum<double[]>(x,y);
    datum.name=rowName;
    data.add(datum);
  }
}

Fixed version (ground truth):
/** 
 * Parse a dataset from a buffered reader.
 * @param name the name of dataset.
 * @param attributes the list attributes of data in proper order.
 * @param reader the buffered reader for data.
 * @throws java.io.IOException
 */
private AttributeDataset parse(String name,Attribute[] attributes,BufferedReader reader) throws IOException, ParseException {
  String line=reader.readLine();
  while (line != null) {
    if (line.isEmpty() || line.startsWith(comment)) {
      line=reader.readLine();
    }
 else {
      break;
    }
  }
  if (line == null) {
    throw new IOException("String_Node_Str");
  }
  String[] s=line.split(delimiter,0);
  if (attributes == null) {
    int p=s.length;
    if (hasRowNames) {
      p--;
    }
    if (responseIndex >= s.length) {
      throw new ParseException("String_Node_Str" + responseIndex,responseIndex);
    }
    if (responseIndex >= 0) {
      p--;
    }
    attributes=new Attribute[p];
    for (int i=0; i < p; i++) {
      attributes[i]=new NumericAttribute("String_Node_Str" + (i + 1));
    }
  }
  int ncols=attributes.length;
  int startColumn=0;
  if (hasRowNames) {
    ncols++;
    startColumn=1;
  }
  if (responseIndex >= 0) {
    ncols++;
  }
  if (ncols != s.length)   throw new ParseException(String.format("String_Node_Str",s.length,ncols),s.length);
  AttributeDataset data=new AttributeDataset(name,attributes,response);
  if (hasColumnNames) {
    for (int i=startColumn, k=0; i < s.length; i++) {
      if (i != responseIndex) {
        attributes[k++].setName(s[i]);
      }
 else {
        response.setName(s[i]);
      }
    }
  }
 else {
    String rowName=hasRowNames ? s[0] : null;
    double[] x=new double[attributes.length];
    double y=Double.NaN;
    for (int i=startColumn, k=0; i < s.length; i++) {
      if (i == responseIndex) {
        y=response.valueOf(s[i]);
      }
 else       if (missing != null && missing.equalsIgnoreCase(s[i])) {
        x[k++]=Double.NaN;
      }
 else {
        x[k]=attributes[k].valueOf(s[i]);
        k++;
      }
    }
    Datum<double[]> datum=new Datum<double[]>(x,y);
    datum.name=rowName;
    data.add(datum);
  }
  while ((line=reader.readLine()) != null) {
    if (line.isEmpty() || line.startsWith(comment)) {
      continue;
    }
    s=line.split(delimiter,0);
    if (s.length != ncols) {
      throw new ParseException(String.format("String_Node_Str",s.length,ncols),s.length);
    }
    String rowName=hasRowNames ? s[0] : null;
    double[] x=new double[attributes.length];
    double y=Double.NaN;
    for (int i=startColumn, k=0; i < s.length; i++) {
      if (i == responseIndex) {
        y=response.valueOf(s[i]);
      }
 else       if (missing != null && missing.equalsIgnoreCase(s[i])) {
        x[k++]=Double.NaN;
      }
 else {
        x[k]=attributes[k].valueOf(s[i]);
        k++;
      }
    }
    Datum<double[]> datum=new Datum<double[]>(x,y);
    datum.name=rowName;
    data.add(datum);
  }
  return data;
}