Program: 89617
Project: 89617
Buggy source:
/** 
 * Execution of the batchjob in its own thread (use start() instead).
 * @throws IOFailure If an IOException is caught while writing the results. 
 */
public void run() throws IOFailure {
  ViewerArcRepositoryClient arcrep=ArcRepositoryClientFactory.getViewerInstance();
  String timestamp=new Long(new Date().getTime()).toString();
  String jobName=BatchGUI.getJobName(batchJob.getClass().getName());
  if (batchJob instanceof LoadableJarBatchJob) {
    LoadableJarBatchJob ljbj=(LoadableJarBatchJob)batchJob;
    jobName=BatchGUI.getJobName(ljbj.getLoadedJobClass());
    log.debug("String_Node_Str" + jobName + "String_Node_Str");
  }
  try {
    File outputFile=new File(BatchGUI.getBatchDir(),jobName + Constants.NAME_TIMSTAMP_SEPARATOR + timestamp+ Constants.OUTPUT_FILE_EXTENSION);
    outputFile.createNewFile();
    File eventLogFile=new File(BatchGUI.getBatchDir(),jobName + Constants.NAME_TIMSTAMP_SEPARATOR + timestamp+ Constants.ERROR_FILE_EXTENSION);
    eventLogFile.createNewFile();
    batchJob.processOnlyFilesMatching(regex);
    FileWriter fw=new FileWriter(eventLogFile,APPEND);
    String processInfo="String_Node_Str" + jobName + "String_Node_Str"+ timestamp+ "String_Node_Str"+ rep.getId()+ "String_Node_Str"+ regex+ "String_Node_Str";
    log.info(processInfo);
    fw.write(processInfo + "String_Node_Str");
    BatchStatus status=arcrep.batch(batchJob,rep.getId());
    final Collection<File> failedFiles=status.getFilesFailed();
    Collection<ExceptionOccurrence> exceptions=status.getExceptions();
    processInfo="String_Node_Str" + jobName + "String_Node_Str"+ status.getNoOfFilesProcessed()+ "String_Node_Str";
    log.info(processInfo);
    fw.write(processInfo + "String_Node_Str");
    processInfo="String_Node_Str" + jobName + "String_Node_Str"+ failedFiles.size()+ "String_Node_Str"+ exceptions.size()+ "String_Node_Str";
    log.info(processInfo);
    fw.write(processInfo + "String_Node_Str");
    if (outputFile != null && outputFile.exists()) {
      status.copyResults(outputFile);
    }
 else {
      log.warn("String_Node_Str" + "String_Node_Str" + StreamUtils.getInputStreamAsString(status.getResultFile().getInputStream()));
    }
    if (!failedFiles.isEmpty()) {
      fw.write("String_Node_Str" + failedFiles.size() + "String_Node_Str");
      for (      File f : failedFiles) {
        fw.write(f.getPath() + "String_Node_Str");
      }
    }
    log.info("String_Node_Str" + jobName + "String_Node_Str"+ exceptions.size()+ "String_Node_Str");
    fw.write("String_Node_Str" + exceptions.size() + "String_Node_Str");
    if (!exceptions.isEmpty()) {
      for (      ExceptionOccurrence e : exceptions) {
        fw.write(e.getFileName() + "String_Node_Str");
        fw.write(e.getException() + "String_Node_Str");
      }
    }
    fw.flush();
    fw.close();
  }
 catch (  IOException e) {
    String errMsg="String_Node_Str" + jobName + "String_Node_Str"+ timestamp+ "String_Node_Str";
    log.error(errMsg,e);
    throw new IOFailure(errMsg,e);
  }
catch (  Throwable e) {
    log.error("String_Node_Str",e);
    throw new IOFailure("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Execution of the batchjob in its own thread (use start() instead).
 * @throws IOFailure If an IOException is caught while writing the results. 
 */
public void run() throws IOFailure {
  ViewerArcRepositoryClient arcrep=ArcRepositoryClientFactory.getViewerInstance();
  String timestamp=Long.valueOf(new Date().getTime()).toString();
  String jobName=BatchGUI.getJobName(batchJob.getClass().getName());
  if (batchJob instanceof LoadableJarBatchJob) {
    LoadableJarBatchJob ljbj=(LoadableJarBatchJob)batchJob;
    jobName=BatchGUI.getJobName(ljbj.getLoadedJobClass());
    log.debug("String_Node_Str" + jobName + "String_Node_Str");
  }
  try {
    File outputFile=new File(BatchGUI.getBatchDir(),jobName + Constants.NAME_TIMSTAMP_SEPARATOR + timestamp+ Constants.OUTPUT_FILE_EXTENSION);
    outputFile.createNewFile();
    File eventLogFile=new File(BatchGUI.getBatchDir(),jobName + Constants.NAME_TIMSTAMP_SEPARATOR + timestamp+ Constants.ERROR_FILE_EXTENSION);
    eventLogFile.createNewFile();
    batchJob.processOnlyFilesMatching(regex);
    FileWriter fw=new FileWriter(eventLogFile,APPEND);
    String processInfo="String_Node_Str" + jobName + "String_Node_Str"+ timestamp+ "String_Node_Str"+ rep.getId()+ "String_Node_Str"+ regex+ "String_Node_Str";
    log.info(processInfo);
    fw.write(processInfo + "String_Node_Str");
    BatchStatus status=arcrep.batch(batchJob,rep.getId());
    final Collection<File> failedFiles=status.getFilesFailed();
    Collection<ExceptionOccurrence> exceptions=status.getExceptions();
    processInfo="String_Node_Str" + jobName + "String_Node_Str"+ status.getNoOfFilesProcessed()+ "String_Node_Str";
    log.info(processInfo);
    fw.write(processInfo + "String_Node_Str");
    processInfo="String_Node_Str" + jobName + "String_Node_Str"+ failedFiles.size()+ "String_Node_Str"+ exceptions.size()+ "String_Node_Str";
    log.info(processInfo);
    fw.write(processInfo + "String_Node_Str");
    if (outputFile != null && outputFile.exists()) {
      status.copyResults(outputFile);
    }
 else {
      log.warn("String_Node_Str" + "String_Node_Str" + StreamUtils.getInputStreamAsString(status.getResultFile().getInputStream()));
    }
    if (!failedFiles.isEmpty()) {
      fw.write("String_Node_Str" + failedFiles.size() + "String_Node_Str");
      for (      File f : failedFiles) {
        fw.write(f.getPath() + "String_Node_Str");
      }
    }
    log.info("String_Node_Str" + jobName + "String_Node_Str"+ exceptions.size()+ "String_Node_Str");
    fw.write("String_Node_Str" + exceptions.size() + "String_Node_Str");
    if (!exceptions.isEmpty()) {
      for (      ExceptionOccurrence e : exceptions) {
        fw.write(e.getFileName() + "String_Node_Str");
        fw.write(e.getException() + "String_Node_Str");
      }
    }
    fw.flush();
    fw.close();
  }
 catch (  IOException e) {
    String errMsg="String_Node_Str" + jobName + "String_Node_Str"+ timestamp+ "String_Node_Str";
    log.error(errMsg,e);
    throw new IOFailure(errMsg,e);
  }
catch (  Throwable e) {
    log.error("String_Node_Str",e);
    throw new IOFailure("String_Node_Str",e);
  }
}