Program: 89888
Project: 89888
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.
 * @throws IOFailure if the call to HeritrixController.requestCrawlStop()fails. Other failures in calls to the controller are caught and logged.
 */
private void doCrawlLoop() throws IOFailure {
  String errorMessage="String_Node_Str";
  long lastNonZeroActiveQueuesTime=System.currentTimeMillis();
  long lastTimeReceivedData=System.currentTimeMillis();
  boolean crawlIsEnded=false;
  try {
    crawlIsEnded=heritrixController.crawlIsEnded();
  }
 catch (  IOFailure e) {
    log.warn(errorMessage,e);
  }
  while (!crawlIsEnded) {
    String harvestInformation=null;
    String progressStats=null;
    try {
      harvestInformation=heritrixController.getHarvestInformation();
      progressStats=heritrixController.getProgressStats();
    }
 catch (    IOFailure e) {
      log.warn(errorMessage,e);
    }
    log.info("String_Node_Str" + files.getJobID() + "String_Node_Str"+ files.getHarvestID()+ "String_Node_Str"+ harvestInformation+ "String_Node_Str"+ progressStats);
    int processedKBPerSec=0;
    boolean paused=false;
    try {
      processedKBPerSec=heritrixController.getCurrentProcessedKBPerSec();
      paused=heritrixController.isPaused();
    }
 catch (    IOFailure e) {
      log.warn(errorMessage,e);
    }
    if (processedKBPerSec > 0 || paused) {
      lastTimeReceivedData=System.currentTimeMillis();
    }
    int activeToeCount=0;
    paused=false;
    try {
      activeToeCount=heritrixController.getActiveToeCount();
      paused=heritrixController.isPaused();
    }
 catch (    IOFailure e) {
      log.warn(errorMessage,e);
    }
    if (activeToeCount > 0 || paused) {
      lastNonZeroActiveQueuesTime=System.currentTimeMillis();
    }
    if ((lastNonZeroActiveQueuesTime + timeOutInMillis < System.currentTimeMillis()) || (lastTimeReceivedData + timeOutInMillisReceivedData < System.currentTimeMillis())) {
      final double noActiveQueuesTimeoutInSeconds=timeOutInMillis / 1000.0;
      final double noDataReceivedTimeoutInSeconds=timeOutInMillisReceivedData / 1000.0;
      long queuedUriCount=0;
      try {
        queuedUriCount=heritrixController.getQueuedUriCount();
      }
 catch (      IOFailure e) {
        log.warn(errorMessage,e);
      }
      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"+ queuedUriCount);
      heritrixController.requestCrawlStop("String_Node_Str");
    }
    try {
      crawlIsEnded=heritrixController.crawlIsEnded();
    }
 catch (    IOFailure e) {
      log.warn(errorMessage,e);
    }
    if (!crawlIsEnded) {
      try {
synchronized (this) {
          wait(WAIT_PERIOD);
        }
      }
 catch (      InterruptedException e) {
        log.trace("String_Node_Str" + e.getMessage());
      }
    }
  }
}

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.
 * @throws IOFailure if the call to HeritrixController.requestCrawlStop()fails. Other failures in calls to the controller are caught and logged.
 */
private void doCrawlLoop() throws IOFailure {
  String errorMessage="String_Node_Str";
  long lastNonZeroActiveQueuesTime=System.currentTimeMillis();
  long lastTimeReceivedData=System.currentTimeMillis();
  boolean crawlIsEnded=false;
  try {
    crawlIsEnded=heritrixController.crawlIsEnded();
  }
 catch (  IOFailure e) {
    log.warn(errorMessage,e);
  }
  while (!crawlIsEnded) {
    String harvestInformation=null;
    String progressStats=null;
    try {
      harvestInformation=heritrixController.getHarvestInformation();
      progressStats=heritrixController.getProgressStats();
    }
 catch (    IOFailure e) {
      log.warn(errorMessage,e);
    }
    log.info("String_Node_Str" + files.getJobID() + "String_Node_Str"+ files.getHarvestID()+ "String_Node_Str"+ harvestInformation+ "String_Node_Str"+ ((progressStats == null) ? "String_Node_Str" : progressStats));
    int processedKBPerSec=0;
    boolean paused=false;
    try {
      processedKBPerSec=heritrixController.getCurrentProcessedKBPerSec();
      paused=heritrixController.isPaused();
    }
 catch (    IOFailure e) {
      log.warn(errorMessage,e);
    }
    if (processedKBPerSec > 0 || paused) {
      lastTimeReceivedData=System.currentTimeMillis();
    }
    int activeToeCount=0;
    paused=false;
    try {
      activeToeCount=heritrixController.getActiveToeCount();
      paused=heritrixController.isPaused();
    }
 catch (    IOFailure e) {
      log.warn(errorMessage,e);
    }
    if (activeToeCount > 0 || paused) {
      lastNonZeroActiveQueuesTime=System.currentTimeMillis();
    }
    if ((lastNonZeroActiveQueuesTime + timeOutInMillis < System.currentTimeMillis()) || (lastTimeReceivedData + timeOutInMillisReceivedData < System.currentTimeMillis())) {
      final double noActiveQueuesTimeoutInSeconds=timeOutInMillis / 1000.0;
      final double noDataReceivedTimeoutInSeconds=timeOutInMillisReceivedData / 1000.0;
      long queuedUriCount=0;
      try {
        queuedUriCount=heritrixController.getQueuedUriCount();
      }
 catch (      IOFailure e) {
        log.warn(errorMessage,e);
      }
      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"+ queuedUriCount);
      heritrixController.requestCrawlStop("String_Node_Str");
    }
    try {
      crawlIsEnded=heritrixController.crawlIsEnded();
    }
 catch (    IOFailure e) {
      log.warn(errorMessage,e);
    }
    if (!crawlIsEnded) {
      try {
synchronized (this) {
          wait(WAIT_PERIOD);
        }
      }
 catch (      InterruptedException e) {
        log.trace("String_Node_Str" + e.getMessage());
      }
    }
  }
}