Program: 30674
Project: 30674
Buggy source:
/** 
 * Reads the Metrics in from the given reader. 
 */
public void read(Reader r){
  BufferedReader in=new BufferedReader(r);
  FormatUtil formatter=new FormatUtil();
  String line=null;
  try {
    Header header=null;
    boolean inHeader=true;
    while ((line=in.readLine()) != null && inHeader) {
      line=line.trim();
      if ("String_Node_Str".equals(line)) {
        inHeader=false;
      }
 else       if (line.startsWith(MAJOR_HEADER_PREFIX)) {
        if (header != null) {
          throw new IllegalStateException("String_Node_Str");
        }
        String className=line.substring(MAJOR_HEADER_PREFIX.length()).trim();
        try {
          header=(Header)loadClass(className).newInstance();
        }
 catch (        Exception e) {
          throw new PicardException("String_Node_Str" + className,e);
        }
      }
 else       if (line.startsWith(MINOR_HEADER_PREFIX)) {
        if (header == null) {
          throw new IllegalStateException("String_Node_Str" + line);
        }
        header.parse(line.substring(MINOR_HEADER_PREFIX.length()));
        this.headers.add(header);
        header=null;
      }
 else {
        throw new PicardException("String_Node_Str" + line);
      }
    }
    if (line == null) {
      throw new PicardException("String_Node_Str");
    }
    while (!line.startsWith(MAJOR_HEADER_PREFIX)) {
      line=in.readLine().trim();
    }
    if (line.startsWith(METRIC_HEADER)) {
      String className=line.split(SEPARATOR)[1];
      Class<?> type=null;
      try {
        type=loadClass(className);
      }
 catch (      ClassNotFoundException cnfe) {
        throw new PicardException("String_Node_Str" + className,cnfe);
      }
      String[] fieldNames=in.readLine().split(SEPARATOR);
      Field[] fields=new Field[fieldNames.length];
      for (int i=0; i < fieldNames.length; ++i) {
        try {
          fields[i]=type.getField(fieldNames[i]);
        }
 catch (        Exception e) {
          throw new PicardException("String_Node_Str" + fieldNames[i] + "String_Node_Str"+ type.getName());
        }
      }
      while ((line=in.readLine()) != null) {
        line=line.trim();
        if ("String_Node_Str".equals(line)) {
          break;
        }
 else {
          String[] values=line.split(SEPARATOR,-1);
          BEAN bean=null;
          try {
            bean=(BEAN)type.newInstance();
          }
 catch (          Exception e) {
            throw new PicardException("String_Node_Str" + type.getName(),e);
          }
          for (int i=0; i < fields.length; ++i) {
            Object value=null;
            if (values[i] != null && values[i].length() > 0) {
              value=formatter.parseObject(values[i],fields[i].getType());
            }
            try {
              fields[i].set(bean,value);
            }
 catch (            Exception e) {
              throw new PicardException("String_Node_Str" + fields[i].getName() + "String_Node_Str"+ type.getName(),e);
            }
          }
          this.metrics.add(bean);
        }
      }
    }
    while (line != null && !line.startsWith(MAJOR_HEADER_PREFIX)) {
      line=in.readLine();
    }
    if (line != null && line.startsWith(HISTO_HEADER)) {
      String keyClassName=line.split(SEPARATOR)[1].trim();
      Class<?> keyClass=null;
      try {
        keyClass=loadClass(keyClassName);
      }
 catch (      ClassNotFoundException cnfe) {
        throw new PicardException("String_Node_Str" + keyClassName);
      }
      String[] labels=in.readLine().split(SEPARATOR);
      for (int i=1; i < labels.length; ++i) {
        this.histograms.add(new Histogram<HKEY>(labels[0],labels[i]));
      }
      while ((line=in.readLine()) != null && !"String_Node_Str".equals(line)) {
        String[] fields=line.trim().split(SEPARATOR);
        HKEY key=(HKEY)formatter.parseObject(fields[0],keyClass);
        for (int i=1; i < fields.length; ++i) {
          double value=formatter.parseDouble(fields[i]);
          this.histograms.get(i - 1).increment(key,value);
        }
      }
    }
  }
 catch (  IOException ioe) {
    throw new PicardException("String_Node_Str",ioe);
  }
}

Fixed version (ground truth):
/** 
 * Reads the Metrics in from the given reader. 
 */
public void read(Reader r){
  BufferedReader in=new BufferedReader(r);
  FormatUtil formatter=new FormatUtil();
  String line=null;
  try {
    Header header=null;
    boolean inHeader=true;
    while ((line=in.readLine()) != null && inHeader) {
      line=line.trim();
      if ("String_Node_Str".equals(line)) {
        inHeader=false;
      }
 else       if (line.startsWith(MAJOR_HEADER_PREFIX)) {
        if (header != null) {
          throw new IllegalStateException("String_Node_Str");
        }
        String className=line.substring(MAJOR_HEADER_PREFIX.length()).trim();
        try {
          header=(Header)loadClass(className).newInstance();
        }
 catch (        Exception e) {
          throw new PicardException("String_Node_Str" + className,e);
        }
      }
 else       if (line.startsWith(MINOR_HEADER_PREFIX)) {
        if (header == null) {
          throw new IllegalStateException("String_Node_Str" + line);
        }
        header.parse(line.substring(MINOR_HEADER_PREFIX.length()));
        this.headers.add(header);
        header=null;
      }
 else {
        throw new PicardException("String_Node_Str" + line);
      }
    }
    if (line == null) {
      throw new PicardException("String_Node_Str");
    }
    while (!line.startsWith(MAJOR_HEADER_PREFIX)) {
      line=in.readLine().trim();
    }
    if (line.startsWith(METRIC_HEADER)) {
      String className=line.split(SEPARATOR)[1];
      Class<?> type=null;
      try {
        type=loadClass(className);
      }
 catch (      ClassNotFoundException cnfe) {
        throw new PicardException("String_Node_Str" + className,cnfe);
      }
      String[] fieldNames=in.readLine().split(SEPARATOR);
      Field[] fields=new Field[fieldNames.length];
      for (int i=0; i < fieldNames.length; ++i) {
        try {
          fields[i]=type.getField(fieldNames[i]);
        }
 catch (        Exception e) {
          throw new PicardException("String_Node_Str" + fieldNames[i] + "String_Node_Str"+ type.getName());
        }
      }
      while ((line=in.readLine()) != null) {
        if ("String_Node_Str".equals(line.trim())) {
          break;
        }
 else {
          String[] values=line.split(SEPARATOR,-1);
          BEAN bean=null;
          try {
            bean=(BEAN)type.newInstance();
          }
 catch (          Exception e) {
            throw new PicardException("String_Node_Str" + type.getName(),e);
          }
          for (int i=0; i < fields.length; ++i) {
            Object value=null;
            if (values[i] != null && values[i].length() > 0) {
              value=formatter.parseObject(values[i],fields[i].getType());
            }
            try {
              fields[i].set(bean,value);
            }
 catch (            Exception e) {
              throw new PicardException("String_Node_Str" + fields[i].getName() + "String_Node_Str"+ type.getName(),e);
            }
          }
          this.metrics.add(bean);
        }
      }
    }
    while (line != null && !line.startsWith(MAJOR_HEADER_PREFIX)) {
      line=in.readLine();
    }
    if (line != null && line.startsWith(HISTO_HEADER)) {
      String keyClassName=line.split(SEPARATOR)[1].trim();
      Class<?> keyClass=null;
      try {
        keyClass=loadClass(keyClassName);
      }
 catch (      ClassNotFoundException cnfe) {
        throw new PicardException("String_Node_Str" + keyClassName);
      }
      String[] labels=in.readLine().split(SEPARATOR);
      for (int i=1; i < labels.length; ++i) {
        this.histograms.add(new Histogram<HKEY>(labels[0],labels[i]));
      }
      while ((line=in.readLine()) != null && !"String_Node_Str".equals(line)) {
        String[] fields=line.trim().split(SEPARATOR);
        HKEY key=(HKEY)formatter.parseObject(fields[0],keyClass);
        for (int i=1; i < fields.length; ++i) {
          double value=formatter.parseDouble(fields[i]);
          this.histograms.get(i - 1).increment(key,value);
        }
      }
    }
  }
 catch (  IOException ioe) {
    throw new PicardException("String_Node_Str",ioe);
  }
}