Program: 50434
Project: 50434
Buggy source:
/** 
 * Reformat compact reads.
 * @throws IOException
 */
@Override public void execute() throws IOException {
  final int numToProcess=inputFilenames.length;
  int numProcessed=0;
  final MutableString sequence=new MutableString();
  final MutableString sequencePair=new MutableString();
  ReadSet readIndexFilter=new ReadSet();
  if (readIndexFilterFile == null) {
    readIndexFilter=null;
  }
 else {
    readIndexFilter.load(readIndexFilterFile);
  }
  for (  final String inputFilename : inputFilenames) {
    int splitIndex=0;
    final String outputBasename;
    final String outputFilename;
    if (numToProcess == 1 && StringUtils.isNotBlank(outputFile)) {
      outputBasename=outputFile;
      boolean hasCompactExtension=false;
      for (      final String extension : FileExtensionHelper.COMPACT_READS_FILE_EXTS) {
        if (outputFile.endsWith(extension)) {
          hasCompactExtension=true;
          break;
        }
      }
      if (hasCompactExtension) {
        outputFilename=outputFile;
      }
 else {
        outputFilename=getOutputFilename(outputBasename,++splitIndex);
      }
    }
 else {
      outputBasename=stripCompactReadExtensions(inputFilename);
      outputFilename=getOutputFilename(outputBasename,++splitIndex);
    }
    if (inputFilename.equals(outputFilename)) {
      System.err.println("String_Node_Str");
      System.exit(2);
    }
    System.out.printf("String_Node_Str",++numProcessed,numToProcess,inputFilename,outputFilename);
    outputFilenames.add(outputFilename);
    ReadsWriter writer=new ReadsWriter(new FileOutputStream(outputFilename));
    writer.setNumEntriesPerChunk(sequencePerChunk);
    final ReadsReader readsReader;
    final FastBufferedInputStream inputFileStream=new FastBufferedInputStream(new FileInputStream(inputFilename));
    if (hasStartOrEndPosition) {
      readsReader=new ReadsReader(startPosition,endPosition,inputFileStream);
    }
 else {
      readsReader=new ReadsReader(inputFileStream);
    }
    int entriesInOutputFile=0;
    for (    final Reads.ReadEntry entry : readsReader) {
      if (readIndexFilter == null || readIndexFilter.contains(entry.getReadIndex())) {
        final int readLength=entry.getReadLength();
        if (readLength < minReadLength || readLength > maxReadLength) {
          continue;
        }
        for (int i=0; i < entry.getMetaDataCount(); i++) {
          Reads.MetaData metaData=entry.getMetaData(i);
          writer.appendMetaData(metaData.getKey(),metaData.getValue());
        }
        if (pushDescription && entry.hasDescription()) {
          writer.setDescription(entry.getDescription());
        }
        if (pushIdentifier && entry.hasReadIdentifier()) {
          writer.setIdentifier(entry.getReadIdentifier());
        }
        processSequenceAndQualityScores(entry,sequence,sequencePair,writer,false);
        processSequenceAndQualityScores(entry,sequence,sequencePair,writer,true);
        writer.appendEntry(entry.getReadIndex());
        entriesInOutputFile++;
        if (entriesInOutputFile > sequencePerOutput) {
          writer.close();
          final String newOutputFilename=getOutputFilename(outputBasename,++splitIndex);
          outputFilenames.add(newOutputFilename);
          System.out.printf("String_Node_Str",newOutputFilename);
          writer=new ReadsWriter(new FileOutputStream(newOutputFilename));
          writer.setNumEntriesPerChunk(sequencePerChunk);
          entriesInOutputFile=0;
        }
      }
    }
    writer.close();
    writer.printStats(System.out);
  }
}

Fixed version (ground truth):
/** 
 * Reformat compact reads.
 * @throws IOException
 */
@Override public void execute() throws IOException {
  final int numToProcess=inputFilenames.length;
  int numProcessed=0;
  final MutableString sequence=new MutableString();
  final MutableString sequencePair=new MutableString();
  ReadSet readIndexFilter=new ReadSet();
  if (readIndexFilterFile == null) {
    readIndexFilter=null;
  }
 else {
    readIndexFilter.load(readIndexFilterFile);
  }
  for (  final String inputFilename : inputFilenames) {
    int splitIndex=0;
    final String outputBasename;
    final String outputFilename;
    if (numToProcess == 1 && StringUtils.isNotBlank(outputFile)) {
      outputBasename=outputFile;
      boolean hasCompactExtension=false;
      for (      final String extension : FileExtensionHelper.COMPACT_READS_FILE_EXTS) {
        if (outputFile.endsWith(extension)) {
          hasCompactExtension=true;
          break;
        }
      }
      if (hasCompactExtension) {
        outputFilename=outputFile;
      }
 else {
        outputFilename=getOutputFilename(outputBasename,++splitIndex);
      }
    }
 else {
      outputBasename=stripCompactReadExtensions(inputFilename);
      outputFilename=getOutputFilename(outputBasename,++splitIndex);
    }
    if (inputFilename.equals(outputFilename)) {
      System.err.println("String_Node_Str");
      System.exit(2);
    }
    System.out.printf("String_Node_Str",++numProcessed,numToProcess,inputFilename,outputFilename);
    outputFilenames.add(outputFilename);
    ReadsWriter writer=new ReadsWriter(new FileOutputStream(outputFilename));
    writer.setNumEntriesPerChunk(sequencePerChunk);
    final ReadsReader readsReader;
    final FastBufferedInputStream inputFileStream=new FastBufferedInputStream(new FileInputStream(inputFilename));
    if (hasStartOrEndPosition) {
      readsReader=new ReadsReader(startPosition,endPosition,inputFileStream);
    }
 else {
      readsReader=new ReadsReader(inputFileStream);
    }
    int entriesInOutputFile=0;
    DistinctIntValueCounter allEntries=new DistinctIntValueCounter();
    int numReadsKept=0;
    for (    final Reads.ReadEntry entry : readsReader) {
      allEntries.observe(entry.getReadIndex());
      if (readIndexFilter == null || readIndexFilter.contains(entry.getReadIndex())) {
        final int readLength=entry.getReadLength();
        if (readLength < minReadLength || readLength > maxReadLength) {
          continue;
        }
        for (int i=0; i < entry.getMetaDataCount(); i++) {
          Reads.MetaData metaData=entry.getMetaData(i);
          writer.appendMetaData(metaData.getKey(),metaData.getValue());
        }
        if (pushDescription && entry.hasDescription()) {
          writer.setDescription(entry.getDescription());
        }
        if (pushIdentifier && entry.hasReadIdentifier()) {
          writer.setIdentifier(entry.getReadIdentifier());
        }
        processSequenceAndQualityScores(entry,sequence,sequencePair,writer,false);
        processSequenceAndQualityScores(entry,sequence,sequencePair,writer,true);
        writer.appendEntry(entry.getReadIndex());
        numReadsKept++;
        entriesInOutputFile++;
        if (entriesInOutputFile > sequencePerOutput) {
          writer.close();
          final String newOutputFilename=getOutputFilename(outputBasename,++splitIndex);
          outputFilenames.add(newOutputFilename);
          System.out.printf("String_Node_Str",newOutputFilename);
          writer=new ReadsWriter(new FileOutputStream(newOutputFilename));
          writer.setNumEntriesPerChunk(sequencePerChunk);
          entriesInOutputFile=0;
        }
      }
    }
    float rate=allEntries.count();
    rate-=numReadsKept;
    rate/=allEntries.count();
    if (readIndexFilter != null)     System.out.printf("String_Node_Str",rate);
    writer.close();
    writer.printStats(System.out);
  }
}