Program: 90233
Project: 90233
Buggy source:
/** 
 * Run a batch job on all ARC entries in the archive. <p/> This currently runs synchronously, and returns only after finish() has been called.
 * @param bitarchiveAppId A String representing the bitarchive AppId.
 * @param job An object that implements the ARCBatchJob interface. The initialize() method will be called before processing and the finish() method will be called afterwards. The process() method will be called with each ARC entry.
 * @throws ArgumentNotValid if job or file is null.
 * @throws IOFailure if there was problems writing to the RemoteFile
 * @return A localBatchStatus
 */
public BatchStatus batch(String bitarchiveAppId,FileBatchJob job){
  ArgumentNotValid.checkNotNull(job,"String_Node_Str");
  log.info("String_Node_Str" + job.getClass().getName());
  BatchStatus returnStatus;
  File tmpFile=null;
  try {
    tmpFile=File.createTempFile("String_Node_Str","String_Node_Str",FileUtils.getTempDir());
    OutputStream os=new FileOutputStream(tmpFile);
    try {
      log.debug("String_Node_Str" + job + "String_Node_Str"+ new Date());
      File[] processFiles=admin.getFilesMatching(job.getFilenamePattern());
      BatchLocalFiles localBatchRunner=new BatchLocalFiles(processFiles);
      localBatchRunner.run(job,os);
      log.debug("String_Node_Str" + job + "String_Node_Str"+ new Date());
    }
  finally {
      try {
        os.close();
      }
 catch (      IOException e) {
        log.warn("String_Node_Str");
      }
    }
    returnStatus=new BatchStatus(bitarchiveAppId,job.getFilesFailed(),job.getNoOfFilesProcessed(),RemoteFileFactory.getMovefileInstance(tmpFile));
  }
 catch (  IOException e) {
    log.fatal("String_Node_Str" + job,e);
    throw new IOFailure("String_Node_Str" + job,e);
  }
  return returnStatus;
}

Fixed version (ground truth):
/** 
 * Run a batch job on all ARC entries in the archive. <p/> This currently runs synchronously, and returns only after finish() has been called.
 * @param bitarchiveAppId A String representing the bitarchive AppId.
 * @param job An object that implements the ARCBatchJob interface. The initialize() method will be called before processing and the finish() method will be called afterwards. The process() method will be called with each ARC entry.
 * @throws ArgumentNotValid if job or file is null.
 * @throws IOFailure if there was problems writing to the RemoteFile
 * @return A localBatchStatus
 */
public BatchStatus batch(String bitarchiveAppId,FileBatchJob job){
  ArgumentNotValid.checkNotNull(job,"String_Node_Str");
  log.info("String_Node_Str" + job.getClass().getName());
  BatchStatus returnStatus;
  File tmpFile=null;
  try {
    tmpFile=File.createTempFile("String_Node_Str","String_Node_Str",FileUtils.getTempDir());
    OutputStream os=new FileOutputStream(tmpFile);
    try {
      log.debug("String_Node_Str" + job + "String_Node_Str"+ new Date());
      File[] processFiles=admin.getFilesMatching(job.getFilenamePattern());
      BatchLocalFiles localBatchRunner=new BatchLocalFiles(processFiles);
      localBatchRunner.run(job,os);
      log.debug("String_Node_Str" + job + "String_Node_Str"+ new Date());
    }
  finally {
      try {
        os.close();
      }
 catch (      IOException e) {
        log.warn("String_Node_Str");
      }
    }
    returnStatus=new BatchStatus(bitarchiveAppId,job.getFilesFailed(),job.getNoOfFilesProcessed(),RemoteFileFactory.getMovefileInstance(tmpFile));
  }
 catch (  IOException e) {
    log.fatal("String_Node_Str" + job,e);
    throw new IOFailure("String_Node_Str" + job,e);
  }
  log.info("String_Node_Str" + job.getClass().getName() + "String_Node_Str"+ returnStatus);
  return returnStatus;
}