Program: 141247
Project: 141247
Buggy source:
/** 
 * Create a GenomeDescription object from a Fasta file of GFF file.
 * @param genomeFastaIs genome fasta input stream
 * @param filename name of the file of the input stream
 * @param gffFormat the input file is in GFF format
 */
public static GenomeDescription createGenomeDesc(final InputStream genomeFastaIs,final String filename,final boolean gffFormat) throws BadBioEntryException, IOException {
  checkNotNull(genomeFastaIs,"String_Node_Str");
  LOGGER.fine("String_Node_Str");
  final GenomeDescription result=new GenomeDescription();
  result.setGenomeName(StringUtils.basename(filename));
  MessageDigest md5Digest;
  try {
    md5Digest=MessageDigest.getInstance("String_Node_Str");
  }
 catch (  NoSuchAlgorithmException e) {
    md5Digest=null;
  }
  final FastaLineParser parser=new FastaLineParser(genomeFastaIs,gffFormat);
  final Alphabet alphabet=Alphabets.AMBIGUOUS_DNA_ALPHABET;
  String seqName=null;
  String lastSeqName=null;
  String parsedSeqName=null;
  long chrSize=0;
  while ((seqName=parser.parseNextLineAndGetSequenceName()) != null) {
    if (!seqName.equals(lastSeqName)) {
      if (result.getSequenceLength(lastSeqName) != -1)       throw new BadBioEntryException("String_Node_Str" + lastSeqName,lastSeqName);
      if (lastSeqName != null)       result.addSequence(parsedSeqName,chrSize);
      parsedSeqName=parseChromosomeName(seqName);
      if (md5Digest != null)       md5Digest.update(parsedSeqName.getBytes(Globals.DEFAULT_FILE_ENCODING));
      lastSeqName=seqName;
      chrSize=0;
    }
    final String sequence=parser.getSequence();
    chrSize+=checkBases(sequence,lastSeqName,alphabet);
    md5Digest.update(sequence.getBytes(Globals.DEFAULT_FILE_ENCODING));
  }
  if (lastSeqName != null)   result.addSequence(parsedSeqName,chrSize);
  if (md5Digest != null)   result.setMD5Sum(digestToString(md5Digest));
  genomeFastaIs.close();
  return result;
}

Fixed version (ground truth):
/** 
 * Create a GenomeDescription object from a Fasta file of GFF file.
 * @param genomeFastaIs genome fasta input stream
 * @param filename name of the file of the input stream
 * @param gffFormat the input file is in GFF format
 */
public static GenomeDescription createGenomeDesc(final InputStream genomeFastaIs,final String filename,final boolean gffFormat) throws BadBioEntryException, IOException {
  checkNotNull(genomeFastaIs,"String_Node_Str");
  LOGGER.fine("String_Node_Str");
  final GenomeDescription result=new GenomeDescription();
  result.setGenomeName(StringUtils.basename(filename));
  MessageDigest md5Digest;
  try {
    md5Digest=MessageDigest.getInstance("String_Node_Str");
  }
 catch (  NoSuchAlgorithmException e) {
    md5Digest=null;
  }
  final FastaLineParser parser=new FastaLineParser(genomeFastaIs,gffFormat);
  final Alphabet alphabet=Alphabets.AMBIGUOUS_DNA_ALPHABET;
  String seqName=null;
  String lastSeqName=null;
  String parsedSeqName=null;
  long chrSize=0;
  while ((seqName=parser.parseNextLineAndGetSequenceName()) != null) {
    if (!seqName.equals(lastSeqName)) {
      if (result.getSequenceLength(lastSeqName) != -1)       throw new BadBioEntryException("String_Node_Str" + lastSeqName,lastSeqName);
      if (lastSeqName != null)       result.addSequence(parsedSeqName,chrSize);
      parsedSeqName=parseChromosomeName(seqName);
      if (parsedSeqName == null)       throw new IOException("String_Node_Str");
      if (md5Digest != null)       md5Digest.update(parsedSeqName.getBytes(Globals.DEFAULT_FILE_ENCODING));
      lastSeqName=seqName;
      chrSize=0;
    }
    final String sequence=parser.getSequence();
    if (sequence == null)     throw new IOException("String_Node_Str");
    chrSize+=checkBases(sequence,lastSeqName,alphabet);
    md5Digest.update(sequence.getBytes(Globals.DEFAULT_FILE_ENCODING));
  }
  if (lastSeqName != null)   result.addSequence(parsedSeqName,chrSize);
  if (md5Digest != null)   result.setMD5Sum(digestToString(md5Digest));
  genomeFastaIs.close();
  return result;
}