Program: 104546
Project: 104546
Buggy source:
private QueryResultSet find(Date startDate,Date endDate,String[] keywords,String field,boolean caseSensitive){
  TreeSet result=new TreeSet(new HistoryRecordComparator());
  Vector filelist=filterFilesByDate(this.historyImpl.getFileList(),startDate,endDate);
  double currentProgress=HistorySearchProgressListener.PROGRESS_MINIMUM_VALUE;
  double fileProgressStep=HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE;
  if (filelist.size() != 0)   fileProgressStep=HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE / filelist.size();
  fireProgressStateChanged(startDate,endDate,keywords,HistorySearchProgressListener.PROGRESS_MINIMUM_VALUE);
  Iterator fileIterator=filelist.iterator();
  while (fileIterator.hasNext()) {
    String filename=(String)fileIterator.next();
    Document doc=this.historyImpl.getDocumentForFile(filename);
    NodeList nodes=doc.getElementsByTagName("String_Node_Str");
    double nodesProgressStep=fileProgressStep;
    if (nodes.getLength() != 0)     nodesProgressStep=fileProgressStep / nodes.getLength();
    Node node;
    for (int i=0; i < nodes.getLength(); i++) {
      node=nodes.item(i);
      String ts=node.getAttributes().getNamedItem("String_Node_Str").getNodeValue();
      Date timestamp=new Date(Long.parseLong(ts));
      if (isInPeriod(timestamp,startDate,endDate)) {
        NodeList propertyNodes=node.getChildNodes();
        HistoryRecord record=filterByKeyword(propertyNodes,timestamp,keywords,field,caseSensitive);
        if (record != null) {
          result.add(record);
        }
      }
      currentProgress+=nodesProgressStep;
      fireProgressStateChanged(startDate,endDate,keywords,(int)currentProgress);
    }
  }
  fireProgressStateChanged(startDate,endDate,keywords,HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE);
  return new OrderedQueryResultSet(result);
}

Fixed version (ground truth):
private QueryResultSet find(Date startDate,Date endDate,String[] keywords,String field,boolean caseSensitive){
  TreeSet result=new TreeSet(new HistoryRecordComparator());
  Vector filelist=filterFilesByDate(this.historyImpl.getFileList(),startDate,endDate);
  double currentProgress=HistorySearchProgressListener.PROGRESS_MINIMUM_VALUE;
  double fileProgressStep=HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE;
  if (filelist.size() != 0)   fileProgressStep=HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE / filelist.size();
  fireProgressStateChanged(startDate,endDate,keywords,HistorySearchProgressListener.PROGRESS_MINIMUM_VALUE);
  Iterator fileIterator=filelist.iterator();
  while (fileIterator.hasNext()) {
    String filename=(String)fileIterator.next();
    Document doc=this.historyImpl.getDocumentForFile(filename);
    NodeList nodes=doc.getElementsByTagName("String_Node_Str");
    double nodesProgressStep=fileProgressStep;
    if (nodes.getLength() != 0)     nodesProgressStep=fileProgressStep / nodes.getLength();
    Node node;
    for (int i=0; i < nodes.getLength(); i++) {
      node=nodes.item(i);
      String ts=node.getAttributes().getNamedItem("String_Node_Str").getNodeValue();
      Date timestamp=new Date(Long.parseLong(ts));
      if (isInPeriod(timestamp,startDate,endDate)) {
        NodeList propertyNodes=node.getChildNodes();
        HistoryRecord record=filterByKeyword(propertyNodes,timestamp,keywords,field,caseSensitive);
        if (record != null) {
          result.add(record);
        }
      }
      currentProgress+=nodesProgressStep;
      fireProgressStateChanged(startDate,endDate,keywords,(int)currentProgress);
    }
  }
  if ((int)currentProgress < HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE) {
    fireProgressStateChanged(startDate,endDate,keywords,HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE);
  }
  return new OrderedQueryResultSet(result);
}