Program: 92557
Project: 92557
Buggy source:
/** 
 * 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++;
      }
    }
    AttributeDataset.Row datum=data.add(x,y);
    datum.name=rowName;
  }
  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++;
      }
    }
    AttributeDataset.Row datum=data.add(x,y);
    datum.name=rowName;
  }
  return data;
}

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++;
      }
    }
    AttributeDataset.Row datum=Double.isNaN(y) ? data.add(x) : data.add(x,y);
    datum.name=rowName;
  }
  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++;
      }
    }
    AttributeDataset.Row datum=Double.isNaN(y) ? data.add(x) : data.add(x,y);
    datum.name=rowName;
  }
  return data;
}