Program: 168116
Project: 168116
Buggy source:
public boolean calculateCooccurrences(List<String> selectedFiles,String seedFile,int windowSize,String outputPath,int threshold,boolean buildMatrix,IProgressMonitor monitor){
  String currentLine=null;
  List<String> phrase=new ArrayList<String>();
  Date currTime=new Date();
  setOutputPath(outputPath);
  setThreshold(threshold);
  setWindowSize(windowSize);
  try {
    boolean ret=false;
    if (windowSize > 0) {
      ret=setSeedWords(seedFile);
    }
    if (ret) {
      doPhrases=true;
      buildSeedCombos();
    }
    String[] listOfFiles=(String[])selectedFiles.toArray(new String[selectedFiles.size()]);
    for (    String fname : listOfFiles) {
      File f=new File(fname);
      monitor.subTask("String_Node_Str" + f.getName());
      appendLog("String_Node_Str" + f.getName());
      if (f.getAbsolutePath().contains("String_Node_Str"))       continue;
      if (!f.exists() || f.isDirectory())       continue;
      BufferedReader br=new BufferedReader(new FileReader(f));
      int line_no=0;
      try {
        while ((currentLine=br.readLine()) != null) {
          ArrayList<String> words=new ArrayList<String>(Arrays.asList(delimiters.matcher(currentLine).replaceAll("String_Node_Str").toLowerCase().trim().split("String_Node_Str")));
          line_no++;
          int windowend=Math.min(windowSize,words.size()) - 1;
          List<String> window=new ArrayList<String>(words.subList(0,windowend));
          String pprev_word=null;
          String prev_word=null;
          for (int wi=0; wi < words.size(); wi++) {
            String word=words.get(wi).trim();
            if (word.isEmpty() || word.equals("String_Node_Str"))             continue;
            if (window.size() > 0)             window.remove(0);
            if (windowend < words.size() && windowSize > 1)             window.add(words.get(windowend++).trim());
            if (buildMatrix) {
              Map<String,Integer> vec=wordMat.get(word);
              if (vec == null) {
                vec=new HashMap<String,Integer>();
                wordMat.put(word,vec);
              }
              for (              String nextWord : window) {
                if (vec.containsKey(nextWord)) {
                  vec.put(nextWord,vec.get(nextWord) + 1);
                }
 else {
                  vec.put(nextWord,1);
                }
                Map<String,Integer> revVec=wordMat.get(nextWord);
                if (revVec == null) {
                  revVec=new HashMap<String,Integer>();
                  wordMat.put(nextWord,revVec);
                }
                if (revVec.containsKey(word)) {
                  revVec.put(word,revVec.get(word) + 1);
                }
 else {
                  revVec.put(word,1);
                }
              }
            }
            if (doPhrases) {
              if (!seedWords.containsKey(word))               continue;
              for (              Set<String> combo : seedCombos.keySet()) {
                boolean flag=true;
                for (                String seedWord : combo) {
                  if (!window.contains(seedWord) && !word.equals(seedWord)) {
                    flag=false;
                    break;
                  }
                }
                if (flag == true) {
                  ArrayList<String> context=new ArrayList<String>();
                  context.addAll(Arrays.asList(pprev_word,prev_word,word));
                  context.addAll(window);
                  if (wi + 1 < words.size())                   context.add(words.get(wi + 1));
                  phrase.add(StringUtils.join(combo,' ') + "String_Node_Str" + f.getName()+ "String_Node_Str"+ line_no+ "String_Node_Str"+ StringUtils.join(context,' '));
                  int phrase_count=seedCombos.get(combo) + 1;
                  seedCombos.put(combo,phrase_count);
                }
              }
            }
            pprev_word=prev_word;
            prev_word=word;
          }
        }
      }
 catch (      OutOfMemoryError e) {
        br.close();
        appendLog("String_Node_Str");
        appendLog("String_Node_Str");
        return false;
      }
      br.close();
      monitor.worked(1);
    }
    try {
      if (buildMatrix) {
        monitor.subTask("String_Node_Str");
        String filename=new SimpleDateFormat("String_Node_Str").format(currTime);
        writeWordMatrix(filename);
      }
      monitor.worked(10);
      if (ret && phrase.size() > 0) {
        monitor.subTask("String_Node_Str");
        String phraseFilename=new SimpleDateFormat("String_Node_Str").format(currTime);
        String freqFilename=new SimpleDateFormat("String_Node_Str").format(currTime);
        writePhrases(phrase,phraseFilename);
        writeSeedComboStats(freqFilename);
      }
 else {
        appendLog("String_Node_Str");
        appendLog("String_Node_Str");
      }
    }
 catch (    OutOfMemoryError e) {
      appendLog("String_Node_Str");
      appendLog("String_Node_Str");
      return false;
    }
    monitor.worked(10);
    appendLog(String.valueOf(phrase.size()));
    Date dateObj=new Date();
    TacitUtility.createRunReport(outputPath,"String_Node_Str",dateObj);
    return true;
  }
 catch (  Exception e) {
    appendLog("String_Node_Str" + e);
  }
  return false;
}

Fixed version (ground truth):
public boolean calculateCooccurrences(List<String> selectedFiles,String seedFile,int windowSize,String outputPath,int threshold,boolean buildMatrix,IProgressMonitor monitor){
  String currentLine=null;
  List<String> phrase=new ArrayList<String>();
  Date currTime=new Date();
  setOutputPath(outputPath);
  setThreshold(threshold);
  setWindowSize(windowSize);
  try {
    boolean ret=false;
    if (windowSize > 0) {
      ret=setSeedWords(seedFile);
    }
    if (ret) {
      doPhrases=true;
      buildSeedCombos();
    }
    String[] listOfFiles=(String[])selectedFiles.toArray(new String[selectedFiles.size()]);
    for (    String fname : listOfFiles) {
      File f=new File(fname);
      monitor.subTask("String_Node_Str" + f.getName());
      appendLog("String_Node_Str" + f.getName());
      if (f.getAbsolutePath().contains("String_Node_Str"))       continue;
      if (!f.exists() || f.isDirectory())       continue;
      BufferedReader br=new BufferedReader(new FileReader(f));
      int line_no=0;
      try {
        while ((currentLine=br.readLine()) != null) {
          ArrayList<String> words=new ArrayList<String>(Arrays.asList(delimiters.matcher(currentLine).replaceAll("String_Node_Str").toLowerCase().trim().split("String_Node_Str")));
          line_no++;
          int windowend=Math.min(windowSize,words.size()) - 1;
          List<String> window=new ArrayList<String>(words.subList(0,windowend));
          String pprev_word=null;
          String prev_word=null;
          for (int wi=0; wi < words.size(); wi++) {
            String word=words.get(wi).trim();
            if (word.isEmpty() || word.equals("String_Node_Str"))             continue;
            if (window.size() > 0)             window.remove(0);
            if (windowend < words.size() && windowSize > 1)             window.add(words.get(windowend++).trim());
            if (buildMatrix) {
              Map<String,Integer> vec=wordMat.get(word);
              if (vec == null) {
                vec=new HashMap<String,Integer>();
                wordMat.put(word,vec);
              }
              for (              String nextWord : window) {
                if (vec.containsKey(nextWord)) {
                  vec.put(nextWord,vec.get(nextWord) + 1);
                }
 else {
                  vec.put(nextWord,1);
                }
                Map<String,Integer> revVec=wordMat.get(nextWord);
                if (revVec == null) {
                  revVec=new HashMap<String,Integer>();
                  wordMat.put(nextWord,revVec);
                }
                if (revVec.containsKey(word)) {
                  revVec.put(word,revVec.get(word) + 1);
                }
 else {
                  revVec.put(word,1);
                }
              }
            }
            if (doPhrases) {
              if (seedWords.containsKey(word)) {
                for (                Set<String> combo : seedCombos.keySet()) {
                  boolean flag=true;
                  String comboStr=StringUtils.join(combo,' ');
                  if (!comboStr.contains(word))                   continue;
                  for (                  String seedWord : combo) {
                    if (!window.contains(seedWord) && !word.equals(seedWord)) {
                      flag=false;
                      break;
                    }
                  }
                  if (flag == true) {
                    ArrayList<String> context=new ArrayList<String>();
                    context.addAll(Arrays.asList(pprev_word,prev_word,word));
                    context.addAll(window);
                    if (wi + window.size() + 1 < words.size())                     context.add(words.get(wi + window.size() + 1));
                    phrase.add(StringUtils.join(combo,' ') + "String_Node_Str" + f.getName()+ "String_Node_Str"+ line_no+ "String_Node_Str"+ StringUtils.join(context,' '));
                    int phrase_count=seedCombos.get(combo) + 1;
                    seedCombos.put(combo,phrase_count);
                  }
                }
              }
            }
            pprev_word=prev_word;
            prev_word=word;
          }
        }
      }
 catch (      OutOfMemoryError e) {
        br.close();
        appendLog("String_Node_Str");
        appendLog("String_Node_Str");
        return false;
      }
      br.close();
      monitor.worked(1);
    }
    try {
      if (buildMatrix) {
        monitor.subTask("String_Node_Str");
        String filename=new SimpleDateFormat("String_Node_Str").format(currTime);
        writeWordMatrix(filename);
      }
      monitor.worked(10);
      if (ret && phrase.size() > 0) {
        monitor.subTask("String_Node_Str");
        String phraseFilename=new SimpleDateFormat("String_Node_Str").format(currTime);
        String freqFilename=new SimpleDateFormat("String_Node_Str").format(currTime);
        writePhrases(phrase,phraseFilename);
        writeSeedComboStats(freqFilename);
      }
 else {
        appendLog("String_Node_Str");
        appendLog("String_Node_Str");
      }
    }
 catch (    OutOfMemoryError e) {
      appendLog("String_Node_Str");
      appendLog("String_Node_Str");
      return false;
    }
    monitor.worked(10);
    appendLog(String.valueOf(phrase.size()));
    Date dateObj=new Date();
    TacitUtility.createRunReport(outputPath,"String_Node_Str",dateObj);
    return true;
  }
 catch (  Exception e) {
    appendLog("String_Node_Str" + e);
  }
  return false;
}