Program: 90248
Project: 90248
Buggy source:
/** 
 * Monitors the crawling performed by Heritrix. Regularly checks whether any progress is made. If no progress has been made for too long, the crawl is ended.
 */
private void doCrawlLoop(){
  long lastNonZeroActiveQueuesTime=System.currentTimeMillis();
  long lastTimeReceivedData=System.currentTimeMillis();
  try {
    while (!heritrixController.crawlIsEnded()) {
      log.info("String_Node_Str" + files.getJobID() + "String_Node_Str"+ this.files.getHarvestID()+ "String_Node_Str"+ heritrixController.getProgressStats());
      if (heritrixController.getCurrentProcessedKBPerSec() > 0 || heritrixController.isPaused()) {
        lastTimeReceivedData=System.currentTimeMillis();
      }
      if (heritrixController.getActiveToeCount() > 0 || heritrixController.isPaused()) {
        lastNonZeroActiveQueuesTime=System.currentTimeMillis();
      }
      if ((lastNonZeroActiveQueuesTime + timeOutInMillis < System.currentTimeMillis()) || (lastTimeReceivedData + timeOutInMillisReceivedData < System.currentTimeMillis())) {
        final double timeoutInSeconds=timeOutInMillis / 1000.0;
        log.warn("String_Node_Str" + "String_Node_Str" + ((System.currentTimeMillis() - lastNonZeroActiveQueuesTime) / 1000.0) + "String_Node_Str"+ timeoutInSeconds+ "String_Node_Str"+ ((System.currentTimeMillis() - lastTimeReceivedData) / 1000.0)+ "String_Node_Str"+ timeoutInSeconds+ "String_Node_Str"+ heritrixController.getQueuedUriCount());
        heritrixController.requestCrawlStop("String_Node_Str");
      }
      if (!heritrixController.crawlIsEnded()) {
        try {
synchronized (this) {
            wait(WAIT_PERIOD);
          }
        }
 catch (        InterruptedException e) {
          log.trace("String_Node_Str" + e.getMessage());
        }
      }
    }
  }
  finally {
    heritrixController.cleanup();
  }
}

Fixed version (ground truth):
/** 
 * Monitors the crawling performed by Heritrix. Regularly checks whether any progress is made. If no progress has been made for too long, the crawl is ended.
 */
private void doCrawlLoop(){
  long lastNonZeroActiveQueuesTime=System.currentTimeMillis();
  long lastTimeReceivedData=System.currentTimeMillis();
  try {
    while (!heritrixController.crawlIsEnded()) {
      log.info("String_Node_Str" + files.getJobID() + "String_Node_Str"+ this.files.getHarvestID()+ "String_Node_Str"+ heritrixController.getProgressStats());
      if (heritrixController.getCurrentProcessedKBPerSec() > 0 || heritrixController.isPaused()) {
        lastTimeReceivedData=System.currentTimeMillis();
      }
      if (heritrixController.getActiveToeCount() > 0 || heritrixController.isPaused()) {
        lastNonZeroActiveQueuesTime=System.currentTimeMillis();
      }
      if ((lastNonZeroActiveQueuesTime + timeOutInMillis < System.currentTimeMillis()) || (lastTimeReceivedData + timeOutInMillisReceivedData < System.currentTimeMillis())) {
        final double noActiveQueuesTimeoutInSeconds=timeOutInMillis / 1000.0;
        final double noDataReceivedTimeoutInSeconds=timeOutInMillisReceivedData / 1000.0;
        log.warn("String_Node_Str" + "String_Node_Str" + ((System.currentTimeMillis() - lastNonZeroActiveQueuesTime) / 1000.0) + "String_Node_Str"+ noActiveQueuesTimeoutInSeconds+ "String_Node_Str"+ ((System.currentTimeMillis() - lastTimeReceivedData) / 1000.0)+ "String_Node_Str"+ noDataReceivedTimeoutInSeconds+ "String_Node_Str"+ heritrixController.getQueuedUriCount());
        heritrixController.requestCrawlStop("String_Node_Str");
      }
      if (!heritrixController.crawlIsEnded()) {
        try {
synchronized (this) {
            wait(WAIT_PERIOD);
          }
        }
 catch (        InterruptedException e) {
          log.trace("String_Node_Str" + e.getMessage());
        }
      }
    }
  }
  finally {
    heritrixController.cleanup();
  }
}