Program: 89733
Project: 89733
Buggy source:
/** 
 * Processes an existing harvestInfoFile:</br> 1. Retrieve jobID, and crawlDir from the harvestInfoFile using class PersistentJobData</br> 2. finds JobId and arcsdir</br> 3. calls storeArcFiles</br> 4. moves harvestdir to oldjobs and deletes crawl.log and other superfluous files.
 * @param crawlDir The location of harvest-info to be processed
 * @param crawlException any exceptions thrown by the crawl which need tobe reported back to the scheduler (may be null for success)
 * @throws IOFailure if the file cannot be read
 */
private void processHarvestInfoFile(File crawlDir,Throwable crawlException) throws IOFailure {
  log.debug("String_Node_Str" + crawlDir.getAbsolutePath() + "String_Node_Str");
  if (!PersistentJobData.existsIn(crawlDir)) {
    throw new IOFailure("String_Node_Str" + crawlDir.getAbsolutePath());
  }
  PersistentJobData harvestInfo=new PersistentJobData(crawlDir);
  Long jobID=harvestInfo.getJobID();
  StringBuilder errorMessage=new StringBuilder();
  DomainHarvestReport dhr=null;
  List<File> failedFiles=new ArrayList<File>();
  HeritrixFiles files=new HeritrixFiles(crawlDir,jobID,harvestInfo.getOrigHarvestDefinitionID());
  try {
    log.info("String_Node_Str" + crawlDir + "String_Node_Str"+ "String_Node_Str"+ jobID+ "String_Node_Str");
    dhr=controller.storeFiles(files,errorMessage,failedFiles);
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + crawlDir.getAbsolutePath() + "String_Node_Str";
    log.warn(msg,e);
    errorMessage.append(e.getMessage()).append("String_Node_Str");
    NotificationsFactory.getInstance().errorEvent(msg + "String_Node_Str" + errorMessage.toString(),e);
  }
 finally {
    CrawlStatusMessage csm;
    if (crawlException == null && errorMessage.length() == 0) {
      log.warn("String_Node_Str" + jobID + "String_Node_Str");
      csm=new CrawlStatusMessage(jobID,JobStatus.DONE,dhr);
    }
 else {
      log.warn("String_Node_Str" + jobID + "String_Node_Str");
      csm=new CrawlStatusMessage(jobID,JobStatus.FAILED,dhr);
      setErrorMessages(csm,crawlException,errorMessage.toString(),dhr == null,failedFiles.size());
    }
    try {
      jmsConnection.send(csm);
      if (crawlException == null && errorMessage.length() == 0) {
        files.deleteFinalLogs();
      }
    }
  finally {
      log.info("String_Node_Str" + jobID + "String_Node_Str");
      files.cleanUpAfterHarvest(new File(Settings.get(HarvesterSettings.HARVEST_CONTROLLER_OLDJOBSDIR)));
    }
  }
  log.info("String_Node_Str" + jobID + "String_Node_Str"+ crawlDir.getAbsolutePath()+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Processes an existing harvestInfoFile:</br> 1. Retrieve jobID, and crawlDir from the harvestInfoFile using class PersistentJobData</br> 2. finds JobId and arcsdir</br> 3. calls storeArcFiles</br> 4. moves harvestdir to oldjobs and deletes crawl.log and other superfluous files.
 * @param crawlDir The location of harvest-info to be processed
 * @param crawlException any exceptions thrown by the crawl which need tobe reported back to the scheduler (may be null for success)
 * @throws IOFailure if the file cannot be read
 */
private void processHarvestInfoFile(File crawlDir,Throwable crawlException) throws IOFailure {
  log.debug("String_Node_Str" + crawlDir.getAbsolutePath() + "String_Node_Str");
  if (!PersistentJobData.existsIn(crawlDir)) {
    throw new IOFailure("String_Node_Str" + crawlDir.getAbsolutePath());
  }
  PersistentJobData harvestInfo=new PersistentJobData(crawlDir);
  Long jobID=harvestInfo.getJobID();
  StringBuilder errorMessage=new StringBuilder();
  DomainHarvestReport dhr=null;
  List<File> failedFiles=new ArrayList<File>();
  HeritrixFiles files=new HeritrixFiles(crawlDir,jobID,harvestInfo.getOrigHarvestDefinitionID());
  try {
    log.info("String_Node_Str" + crawlDir + "String_Node_Str"+ "String_Node_Str"+ jobID+ "String_Node_Str");
    dhr=controller.storeFiles(files,errorMessage,failedFiles);
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + crawlDir.getAbsolutePath() + "String_Node_Str";
    log.warn(msg,e);
    errorMessage.append(e.getMessage()).append("String_Node_Str");
    NotificationsFactory.getInstance().errorEvent(msg + "String_Node_Str" + errorMessage.toString(),e);
  }
 finally {
    CrawlStatusMessage csm;
    if (crawlException == null && errorMessage.length() == 0) {
      log.info("String_Node_Str" + jobID + "String_Node_Str");
      csm=new CrawlStatusMessage(jobID,JobStatus.DONE,dhr);
    }
 else {
      log.warn("String_Node_Str" + jobID + "String_Node_Str");
      csm=new CrawlStatusMessage(jobID,JobStatus.FAILED,dhr);
      setErrorMessages(csm,crawlException,errorMessage.toString(),dhr == null,failedFiles.size());
    }
    try {
      jmsConnection.send(csm);
      if (crawlException == null && errorMessage.length() == 0) {
        files.deleteFinalLogs();
      }
    }
  finally {
      log.info("String_Node_Str" + jobID + "String_Node_Str");
      files.cleanUpAfterHarvest(new File(Settings.get(HarvesterSettings.HARVEST_CONTROLLER_OLDJOBSDIR)));
    }
  }
  log.info("String_Node_Str" + jobID + "String_Node_Str"+ crawlDir.getAbsolutePath()+ "String_Node_Str");
}