Program: 24739
Project: 24739
Buggy source:
/** 
 * Performs the pair-adding phase of the flush procedure.
 */
private void flushPhase2(ProgressTracker prog) throws IOException {
  if (!pairQueueFile.canRead())   return;
  PairFreqData pairData=new PairFreqData();
  if (pairFreqFile.canRead())   pairData.add(pairFreqFile);
  CountedInputStream queueCounted=new CountedInputStream(new FileInputStream(pairQueueFile));
  BufferedReader queueReader=new BufferedReader(new InputStreamReader(queueCounted,"String_Node_Str"));
  ProgressTracker[] subProgs=prog.split(90,10);
  long fileTotal=pairQueueFile.length();
  int prevPctDone=0;
  int totalAdded=0;
  try {
    boolean eof=false;
    while (!eof) {
      String line=queueReader.readLine();
      if (line == null) {
        eof=true;
        break;
      }
      String[] tokens=splitPat.split(line);
      if (tokens.length == 3) {
        String word1=tokens[0];
        String word2=tokens[1];
        String countTxt=tokens[2];
        try {
          pairData.add(word1,word2,Integer.parseInt(countTxt));
          ++totalAdded;
          if ((totalAdded & 0xFFF) == 0) {
            long filePos=queueCounted.nRead();
            int pctDone=(int)((filePos + 1) * 90 / (fileTotal + 1));
            subProgs[0].progress(filePos + 1,fileTotal + 1,"String_Node_Str" + totalAdded + "String_Node_Str");
          }
        }
 catch (        NumberFormatException e) {
        }
      }
    }
  }
  finally {
    queueReader.close();
    queueCounted.close();
  }
  File newPairFreqFile=new File(spellIndexDir,"String_Node_Str");
  newPairFreqFile.delete();
  subProgs[1].progress(50,100,"String_Node_Str");
  pairData.save(newPairFreqFile);
  if (pairFreqFile.canRead() && !pairFreqFile.delete())   throw new IOException("String_Node_Str");
  if (!newPairFreqFile.renameTo(pairFreqFile))   throw new IOException("String_Node_Str");
  FileOutputStream tmp=new FileOutputStream(pairQueueFile);
  tmp.close();
  pairQueueFile.delete();
}

Fixed version (ground truth):
/** 
 * Performs the pair-adding phase of the flush procedure.
 */
private void flushPhase2(ProgressTracker prog) throws IOException {
  if (!pairQueueFile.canRead())   return;
  PairFreqData pairData=new PairFreqData();
  if (pairFreqFile.canRead())   pairData.add(pairFreqFile);
  CountedInputStream queueCounted=new CountedInputStream(new FileInputStream(pairQueueFile));
  BufferedReader queueReader=new BufferedReader(new InputStreamReader(queueCounted,"String_Node_Str"));
  ProgressTracker[] subProgs=prog.split(90,10);
  long fileTotal=pairQueueFile.length();
  int totalAdded=0;
  try {
    boolean eof=false;
    while (!eof) {
      String line=queueReader.readLine();
      if (line == null) {
        eof=true;
        break;
      }
      String[] tokens=splitPat.split(line);
      if (tokens.length == 3) {
        String word1=tokens[0];
        String word2=tokens[1];
        String countTxt=tokens[2];
        try {
          pairData.add(word1,word2,Integer.parseInt(countTxt));
          ++totalAdded;
          if ((totalAdded & 0xFFF) == 0) {
            long filePos=queueCounted.nRead();
            subProgs[0].progress(filePos + 1,fileTotal + 1,"String_Node_Str" + totalAdded + "String_Node_Str");
          }
        }
 catch (        NumberFormatException e) {
        }
      }
    }
  }
  finally {
    queueReader.close();
    queueCounted.close();
  }
  File newPairFreqFile=new File(spellIndexDir,"String_Node_Str");
  newPairFreqFile.delete();
  subProgs[1].progress(50,100,"String_Node_Str");
  pairData.save(newPairFreqFile);
  if (pairFreqFile.canRead() && !pairFreqFile.delete())   throw new IOException("String_Node_Str");
  if (!newPairFreqFile.renameTo(pairFreqFile))   throw new IOException("String_Node_Str");
  FileOutputStream tmp=new FileOutputStream(pairQueueFile);
  tmp.close();
  pairQueueFile.delete();
}