nus-yam/ex-repair huggingface dataset:
Program: 89571
Project: 89571
Buggy source:
private void doUpdateChecksumAndFileStatus() throws Exception {
  Long stepTimeout=24 * 3600 * 1000L;
  String minStepTimeHoursString=System.getProperty("String_Node_Str","String_Node_Str");
  System.out.println("String_Node_Str" + minStepTimeHoursString + "String_Node_Str");
  Long minStepTime=Integer.parseInt(minStepTimeHoursString) * 3600 * 1000L;
  WebDriver driver=new FirefoxDriver();
  ApplicationManager applicationManager=new ApplicationManager(environmentManager);
  driver.manage().timeouts().implicitlyWait(1,TimeUnit.SECONDS);
  String baseUrl=environmentManager.getGuiHost() + "String_Node_Str" + environmentManager.getGuiPort();
  PageHelper.initialize(driver,baseUrl);
  applicationManager.waitForGUIToStart(60);
  addFixture("String_Node_Str");
  addStep("String_Node_Str","String_Node_Str");
  driver.manage().timeouts().pageLoadTimeout(10L,TimeUnit.MINUTES);
  driver.findElement(By.linkText("String_Node_Str")).click();
  WebElement updateLink=driver.findElement(By.linkText("String_Node_Str"));
  updateLink.click();
  Long startTime=System.currentTimeMillis();
  String progressS="String_Node_Str";
  Pattern progress=Pattern.compile(progressS,Pattern.DOTALL);
  String finishedS="String_Node_Str";
  Pattern finished=Pattern.compile(finishedS,Pattern.DOTALL);
  boolean isFinished=false;
  while (!isFinished) {
    Long timeElapsed=System.currentTimeMillis() - startTime;
    if (timeElapsed > stepTimeout) {
      fail("String_Node_Str" + stepTimeout / 1000 + "String_Node_Str");
    }
    driver.findElement(By.linkText("String_Node_Str")).click();
    List<WebElement> logMessages=driver.findElements(By.tagName("String_Node_Str"));
    for (    WebElement webElement : logMessages) {
      if (finished.matcher(webElement.getText()).matches()) {
        isFinished=true;
        if (timeElapsed < minStepTime) {
          fail("String_Node_Str" + timeElapsed / 1000 + "String_Node_Str" + minStepTime / 1000 + "String_Node_Str");
        }
        TestEventManager.getInstance().addResult("String_Node_Str" + timeElapsed / 1000 + "String_Node_Str");
      }
    }
    if (!isFinished) {
      for (      WebElement webElement : logMessages) {
        Matcher matcher=progress.matcher(webElement.getText());
        if (matcher.matches()) {
          System.out.println("String_Node_Str" + matcher.group(1) + "String_Node_Str"+ timeElapsed / 1000 + "String_Node_Str");
        }
      }
    }
    if (!isFinished) {
      Thread.sleep(10 * 1000L);
    }
  }
  driver.close();
}

Fixed version (ground truth):
private void doUpdateChecksumAndFileStatus() throws Exception {
  Long stepTimeout=24 * 3600 * 1000L;
  String minStepTimeHoursString=System.getProperty("String_Node_Str","String_Node_Str");
  System.out.println("String_Node_Str" + minStepTimeHoursString + "String_Node_Str");
  Long minStepTime=Integer.parseInt(minStepTimeHoursString) * 3600 * 1000L;
  UpdateChecksumJob updateChecksumJob=new UpdateChecksumJob(this,new ApplicationManager(environmentManager),new FirefoxDriver(),60 * 1000L,10 * 1000L,stepTimeout,"String_Node_Str");
  updateChecksumJob.run();
}
Program: 89572
Project: 89572
Buggy source:
@Override void startJob(){
  driver.manage().timeouts().implicitlyWait(1,TimeUnit.SECONDS);
  String baseUrl=environmentManager.getGuiHost() + "String_Node_Str" + environmentManager.getGuiPort();
  PageHelper.initialize(driver,baseUrl);
  addStep("String_Node_Str","String_Node_Str");
  driver.manage().timeouts().pageLoadTimeout(20L,TimeUnit.MINUTES);
  driver.findElement(By.linkText("String_Node_Str")).click();
  WebElement updateLink=driver.findElement(By.linkText("String_Node_Str"));
  updateLink.click();
}

Fixed version (ground truth):
@Override void startJob(){
  driver.manage().timeouts().pageLoadTimeout(10L,TimeUnit.MINUTES);
  driver.findElement(By.linkText("String_Node_Str")).click();
  WebElement updateLink=driver.findElement(By.linkText("String_Node_Str"));
  updateLink.click();
}
Program: 89573
Project: 89573
Buggy source:
@Override boolean isStarted(){
  return true;
}

Fixed version (ground truth):
@Override boolean isStarted(){
  try {
    String output=environmentManager.runCommand(TestEnvironment.JOB_ADMIN_SERVER,"String_Node_Str" + TESTNAME + "String_Node_Str",new int[]{0,1});
    final String startedS="String_Node_Str";
    Pattern startedP=Pattern.compile(startedS,Pattern.DOTALL);
    final Matcher matcher=startedP.matcher(output);
    if (matcher.matches()) {
      total=matcher.group(1);
      return true;
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  return false;
}
Program: 89574
Project: 89574
Buggy source:
@Override boolean isFinished(){
  driver.manage().timeouts().pageLoadTimeout(20L,TimeUnit.MINUTES);
  driver.findElement(By.linkText("String_Node_Str")).click();
  WebElement updateLink=driver.findElement(By.linkText("String_Node_Str"));
  String idNumber="String_Node_Str";
  String idMissing="String_Node_Str";
  String numberS=driver.findElement(By.id(idNumber)).getText();
  return numberS.equals("String_Node_Str");
}

Fixed version (ground truth):
@Override boolean isFinished(){
  try {
    String output=environmentManager.runCommand(TestEnvironment.JOB_ADMIN_SERVER,"String_Node_Str" + TESTNAME + "String_Node_Str",new int[]{0,1});
    final String finishedS="String_Node_Str";
    Pattern finishedP=Pattern.compile(finishedS,Pattern.DOTALL);
    final Matcher matcher=finishedP.matcher(output);
    if (matcher.matches()) {
      total=matcher.group(1);
      return true;
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  return false;
}
Program: 89575
Project: 89575
Buggy source:
@Override String getProgress(){
  String numberS=driver.findElement(By.id(idNumber)).getText();
  String missingS=driver.findElement(By.id(idMissing)).getText();
  return "String_Node_Str" + numberS + "String_Node_Str"+ missingS;
}

Fixed version (ground truth):
@Override String getProgress(){
  driver.findElement(By.linkText("String_Node_Str")).click();
  driver.findElement(By.linkText("String_Node_Str")).click();
  final String progressS="String_Node_Str";
  Pattern progressP=Pattern.compile(progressS,Pattern.DOTALL);
  WebElement webElement=driver.findElement(By.tagName("String_Node_Str"));
  if (webElement != null) {
    Matcher matcher=progressP.matcher(webElement.getText());
    if (matcher.matches()) {
      return "String_Node_Str" + matcher.group(1) + "String_Node_Str"+ total;
    }
  }
  return null;
}
Program: 89576
Project: 89576
Buggy source:
@Override void startJob(){
  driver.manage().timeouts().implicitlyWait(1,TimeUnit.SECONDS);
  String baseUrl=environmentManager.getGuiHost() + "String_Node_Str" + environmentManager.getGuiPort();
  PageHelper.initialize(driver,baseUrl);
  addStep("String_Node_Str","String_Node_Str");
  driver.manage().timeouts().pageLoadTimeout(20L,TimeUnit.MINUTES);
  driver.findElement(By.linkText("String_Node_Str")).click();
  WebElement updateLink=driver.findElement(By.linkText("String_Node_Str"));
}

Fixed version (ground truth):
@Override void startJob(){
  driver.manage().timeouts().implicitlyWait(1,TimeUnit.SECONDS);
  String baseUrl=environmentManager.getGuiHost() + "String_Node_Str" + environmentManager.getGuiPort();
  PageHelper.initialize(driver,baseUrl);
  addStep("String_Node_Str","String_Node_Str");
  driver.manage().timeouts().pageLoadTimeout(20L,TimeUnit.MINUTES);
  driver.findElement(By.linkText("String_Node_Str")).click();
  WebElement updateLink=driver.findElement(By.linkText("String_Node_Str"));
  updateLink.click();
}
Program: 89578
Project: 89578
Buggy source:
@BeforeTest(alwaysRun=true) protected void setupTest(){
  environmentManager=new TestEnvironmentManager(TESTNAME,null,8073);
}

Fixed version (ground truth):
@BeforeTest(alwaysRun=true) protected void setupTest(){
  environmentManager=new TestEnvironmentManager(TESTNAME,"String_Node_Str",8073);
}
Program: 89581
Project: 89581
Buggy source:
/** 
 * Turns a raw CDX file for the given jobID into a metadatafile containing the CDX lines in one ARC entry per ARC file indexed. The output is put into a file called &lt;jobID&gt;-metadata-1.arc.
 * @param resultFile The CDX file returned by a ExtractCDXJob for thegiven jobID.
 * @param jobID The jobID we work on.
 * @throws IOException If an I/O error occurs, or the resultFiledoes not exist
 */
private void arcifyResultFile(File resultFile,long jobID) throws IOException {
  BufferedReader reader=new BufferedReader(new FileReader(resultFile));
  try {
    ARCWriter writer=ARCUtils.createARCWriter(new File(MetadataFileWriter.getMetadataArchiveFileName(Long.toString(jobID))));
    try {
      String line;
      ByteArrayOutputStream baos=new ByteArrayOutputStream();
      String lastFilename=null;
      FileUtils.FilenameParser parser=null;
      while ((line=reader.readLine()) != null) {
        parser=parseLine(line,jobID);
        if (parser == null) {
          continue;
        }
        if (!parser.getFilename().equals(lastFilename)) {
          writeCDXEntry(writer,parser,baos.toByteArray());
          baos.reset();
          lastFilename=parser.getFilename();
        }
        baos.write(line.getBytes());
        baos.write("String_Node_Str".getBytes());
      }
      if (parser != null) {
        writeCDXEntry(writer,parser,baos.toByteArray());
      }
    }
  finally {
      writer.close();
    }
  }
  finally {
    reader.close();
  }
}

Fixed version (ground truth):
/** 
 * Turns a raw CDX file for the given jobID into a metadatafile containing the CDX lines in one archive record per each ARC or WARC file indexed. The output is put into a file called &lt;jobID&gt;-metadata-1.arc.
 * @param resultFile The CDX file returned by a ExtractCDXJob for thegiven jobID.
 * @param jobID The jobID we work on.
 * @param warcmode write the data to a WARC metadata file or not.
 * @throws IOException If an I/O error occurs, or the resultFiledoes not exist
 */
private void arcifyResultFile(File resultFile,long jobID) throws IOException {
  BufferedReader reader=new BufferedReader(new FileReader(resultFile));
  File outputFile=new File(MetadataFileWriter.getMetadataArchiveFileName(Long.toString(jobID)));
  try {
    MetadataFileWriter writer=MetadataFileWriter.createWriter(outputFile);
    try {
      String line;
      ByteArrayOutputStream baos=new ByteArrayOutputStream();
      String lastFilename=null;
      FileUtils.FilenameParser parser=null;
      while ((line=reader.readLine()) != null) {
        parser=parseLine(line,jobID);
        if (parser == null) {
          continue;
        }
        if (!parser.getFilename().equals(lastFilename)) {
          writeCDXEntry(writer,parser,baos.toByteArray());
          baos.reset();
          lastFilename=parser.getFilename();
        }
        baos.write(line.getBytes());
        baos.write("String_Node_Str".getBytes());
      }
      if (parser != null) {
        writeCDXEntry(writer,parser,baos.toByteArray());
      }
    }
  finally {
      writer.close();
    }
  }
  finally {
    reader.close();
  }
}
Program: 89582
Project: 89582
Buggy source:
/** 
 * Writes a full entry of CDX files to the ARCWriter.
 * @param writer The writer we're currently writing to.
 * @param parser The filename of all the entries stored in baos.  Thisis used to generate the URI for the entry.
 * @param bytes The bytes of the CDX records to be written under thisentry.
 * @throws IOFailure if the write fails for any reason
 */
private void writeCDXEntry(ARCWriter writer,FileUtils.FilenameParser parser,byte[] bytes) throws IOFailure {
  try {
    ByteArrayInputStream bais=new ByteArrayInputStream(bytes);
    writer.write(HarvestDocumentation.getCDXURI(parser.getHarvestID(),parser.getJobID(),parser.getTimeStamp(),parser.getSerialNo()).toString(),Constants.CDX_MIME_TYPE,SystemUtils.getLocalIP(),System.currentTimeMillis(),bytes.length,bais);
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str" + "String_Node_Str" + parser.getFilename(),e);
  }
}

Fixed version (ground truth):
/** 
 * Writes a full entry of CDX files to the ARCWriter.
 * @param writer The writer we're currently writing to.
 * @param parser The filename of all the entries stored in baos.  Thisis used to generate the URI for the entry.
 * @param bytes The bytes of the CDX records to be written under thisentry.
 * @throws IOFailure if the write fails for any reason
 */
private void writeCDXEntry(MetadataFileWriter writer,FileUtils.FilenameParser parser,byte[] bytes) throws IOFailure {
  try {
    writer.write(HarvestDocumentation.getCDXURI(parser.getHarvestID(),parser.getJobID(),parser.getTimeStamp(),parser.getSerialNo()).toString(),Constants.CDX_MIME_TYPE,SystemUtils.getLocalIP(),System.currentTimeMillis(),bytes);
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str" + "String_Node_Str" + parser.getFilename(),e);
  }
}
Program: 89583
Project: 89583
Buggy source:
/** 
 * The workhorse method of this tool: Runs the batch job, copies the result, then turns the result into a proper metadata file.
 * @param args Arguments given on the command line.
 */
public void run(String... args){
  long jobID=Long.parseLong(args[0]);
  FileBatchJob job=new ExtractCDXJob();
  job.processOnlyFilesMatching(jobID + REMAINING_ARC_FILE_PATTERN);
  BatchStatus status=arcrep.batch(job,Settings.get(CommonSettings.USE_REPLICA_ID));
  if (status.hasResultFile()) {
    File resultFile=null;
    try {
      resultFile=File.createTempFile("String_Node_Str","String_Node_Str",FileUtils.getTempDir());
      resultFile.deleteOnExit();
      status.copyResults(resultFile);
      arcifyResultFile(resultFile,jobID);
    }
 catch (    IOException e) {
      throw new IOFailure("String_Node_Str" + jobID,e);
    }
 finally {
      if (resultFile != null) {
        FileUtils.remove(resultFile);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * The workhorse method of this tool: Runs the batch job, copies the result, then turns the result into a proper metadata file. This method assumes that the args have already been read  by the checkArgs method, and thus jobId has been parsed,  and the isWarcOutputMode established
 * @param args Arguments given on the command line.
 */
public void run(String... args){
  long jobID=this.jobId;
  FileBatchJob job=new ArchiveExtractCDXJob();
  Settings.set(HarvesterSettings.METADATA_FORMAT,(isWarcOutputMode) ? "String_Node_Str" : "String_Node_Str");
  job.processOnlyFilesMatching(jobID + REMAINING_ARCHIVE_FILE_PATTERN);
  BatchStatus status=arcrep.batch(job,Settings.get(CommonSettings.USE_REPLICA_ID));
  if (status.hasResultFile()) {
    File resultFile=null;
    try {
      resultFile=File.createTempFile("String_Node_Str","String_Node_Str",FileUtils.getTempDir());
      resultFile.deleteOnExit();
      status.copyResults(resultFile);
      arcifyResultFile(resultFile,jobID);
    }
 catch (    IOException e) {
      throw new IOFailure("String_Node_Str" + jobID,e);
    }
 finally {
      if (resultFile != null) {
        FileUtils.remove(resultFile);
      }
    }
  }
}
Program: 89584
Project: 89584
Buggy source:
/** 
 * Check that a valid jobID were given.  This does not check whether jobs actually exist for that ID.
 * @param args The args given on the command line.
 * @return True if the args are legal.
 */
public boolean checkArgs(String... args){
  if (args.length < 1) {
    System.err.println("String_Node_Str");
    return false;
  }
  if (args.length > 1) {
    System.err.println("String_Node_Str" + StringUtils.conjoin("String_Node_Str",Arrays.asList(args)) + "String_Node_Str");
    return false;
  }
  try {
    if (Long.parseLong(args[0]) < 1) {
      System.err.println("String_Node_Str" + args[0] + "String_Node_Str");
      return false;
    }
    return true;
  }
 catch (  NumberFormatException e) {
    System.err.println("String_Node_Str" + args[0] + "String_Node_Str");
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Check that a valid jobID were given.  This does not check whether jobs actually exist for that ID.
 * @param args The args given on the command line.
 * @return True if the args are legal.
 */
public boolean checkArgs(String... args){
  Options options=new Options();
  options.addOption("String_Node_Str",false,"String_Node_Str");
  options.addOption("String_Node_Str",false,"String_Node_Str");
  CommandLineParser parser=new PosixParser();
  try {
    CommandLine cl=parser.parse(options,args);
    if (cl.hasOption('a') && cl.hasOption('w')) {
      System.err.println("String_Node_Str");
      return false;
    }
    if (cl.hasOption('a')) {
      this.isWarcOutputMode=false;
    }
 else {
      this.isWarcOutputMode=true;
    }
  }
 catch (  ParseException e) {
    System.err.println("String_Node_Str" + e);
    return false;
  }
  if (args.length < 1) {
    System.err.println("String_Node_Str");
    return false;
  }
  int jobIdIndex=args.length - 1;
  try {
    if (Long.parseLong(args[jobIdIndex]) < 1) {
      System.err.println("String_Node_Str" + args[jobIdIndex] + "String_Node_Str");
      return false;
    }
    return true;
  }
 catch (  NumberFormatException e) {
    System.err.println("String_Node_Str" + args[jobIdIndex] + "String_Node_Str");
    return false;
  }
}
Program: 89585
Project: 89585
Buggy source:
@Override public ArchiveBatchFilter getFilter(){
  return new ArchiveBatchFilter("String_Node_Str"){
    public boolean accept(    ArchiveRecordBase record){
      return record.getHeader().getUrl().startsWith(SETUP_URL_FORMAT);
    }
  }
;
}

Fixed version (ground truth):
@Override public ArchiveBatchFilter getFilter(){
  return new ArchiveBatchFilter("String_Node_Str"){
    public boolean accept(    ArchiveRecordBase record){
      String URL=record.getHeader().getUrl();
      if (URL == null) {
        return false;
      }
 else {
        return URL.startsWith(SETUP_URL_FORMAT);
      }
    }
  }
;
}
Program: 89586
Project: 89586
Buggy source:
public boolean accept(ArchiveRecordBase record){
  return record.getHeader().getUrl().startsWith(SETUP_URL_FORMAT);
}

Fixed version (ground truth):
public boolean accept(ArchiveRecordBase record){
  String URL=record.getHeader().getUrl();
  if (URL == null) {
    return false;
  }
 else {
    return URL.startsWith(SETUP_URL_FORMAT);
  }
}
Program: 89587
Project: 89587
Buggy source:
/** 
 * Builds a harvest definition info object.
 * @param origHarvestName the harvest definition's name
 * @param origHarvestDesc the harvest definition's comments
 * @param scheduleName the harvest definition's schedule name (only applicable for selective harvests) 
 */
public HarvestDefinitionInfo(String origHarvestName,String origHarvestDesc,String scheduleName){
  super();
  ArgumentNotValid.checkNotNullOrEmpty(origHarvestName,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(origHarvestDesc,"String_Node_Str");
  ArgumentNotValid.checkNotNull(scheduleName,"String_Node_Str");
  this.origHarvestName=origHarvestName;
  this.origHarvestDesc=origHarvestDesc;
  this.scheduleName=scheduleName;
}

Fixed version (ground truth):
/** 
 * Builds a harvest definition info object.
 * @param origHarvestName the harvest definition's name
 * @param origHarvestDesc the harvest definition's comments (can be empty string)
 * @param scheduleName the harvest definition's schedule name (only applicable for selective harvests) 
 */
public HarvestDefinitionInfo(String origHarvestName,String origHarvestDesc,String scheduleName){
  super();
  ArgumentNotValid.checkNotNullOrEmpty(origHarvestName,"String_Node_Str");
  ArgumentNotValid.checkNotNull(origHarvestDesc,"String_Node_Str");
  ArgumentNotValid.checkNotNull(scheduleName,"String_Node_Str");
  this.origHarvestName=origHarvestName;
  this.origHarvestDesc=origHarvestDesc;
  this.scheduleName=scheduleName;
}
Program: 89590
Project: 89590
Buggy source:
/** 
 * Create a new LocalArcRepositoryClient based on current settings. 
 */
public LocalArcRepositoryClient(){
  List<String> fileDirs=Arrays.asList(Settings.getAll(FILE_DIRS));
  if (fileDirs.size() == 0) {
    fileDirs.add(DEFAULT_DIR_NAME);
  }
  for (  String fileName : fileDirs) {
    File f=new File(fileName);
    FileUtils.createDir(f);
    log.info("String_Node_Str" + f.getAbsolutePath() + "String_Node_Str");
    storageDirs.add(f);
  }
}

Fixed version (ground truth):
/** 
 * Create a new LocalArcRepositoryClient based on current settings. 
 */
public LocalArcRepositoryClient(){
  List<String> fileDirs=Arrays.asList(Settings.getAll(FILE_DIRS));
  for (  String fileName : fileDirs) {
    File f=new File(fileName);
    FileUtils.createDir(f);
    log.info("String_Node_Str" + f.getAbsolutePath() + "String_Node_Str");
    storageDirs.add(f);
  }
}
Program: 89592
Project: 89592
Buggy source:
/** 
 * Add tests to suite. One line for each unit-test class in this testsuite.
 * @param suite the suite.
 */
public static void addToSuite(TestSuite suite){
  suite.addTestSuite(DomainnameQueueAssignmentPolicyTester.class);
  suite.addTestSuite(HeritrixControllerFactoryTester.class);
  suite.addTestSuite(HarvestControllerTester.class);
  suite.addTestSuite(HarvestDocumentationTester.class);
  suite.addTestSuite(LegacyHarvestReportTester.class);
  suite.addTestSuite(HeritrixFilesTester.class);
  suite.addTestSuite(HeritrixLauncherTester.class);
  suite.addTestSuite(IngestableFilesTester.class);
  suite.addTestSuite(OnNSDomainsDecideRuleTester.class);
  suite.addTestSuite(ExtractorOAITest.class);
  suite.addTestSuite(MetadataFileWriterTester.class);
}

Fixed version (ground truth):
/** 
 * Add tests to suite. One line for each unit-test class in this testsuite.
 * @param suite the suite.
 */
public static void addToSuite(TestSuite suite){
  suite.addTestSuite(DomainnameQueueAssignmentPolicyTester.class);
  suite.addTestSuite(HeritrixControllerFactoryTester.class);
  suite.addTestSuite(HarvestControllerTester.class);
  suite.addTestSuite(HarvestDocumentationTester.class);
  suite.addTestSuite(LegacyHarvestReportTester.class);
  suite.addTestSuite(HeritrixFilesTester.class);
  suite.addTestSuite(HeritrixLauncherTester.class);
  suite.addTestSuite(IngestableFilesTester.class);
  suite.addTestSuite(OnNSDomainsDecideRuleTester.class);
  suite.addTestSuite(ExtractorOAITest.class);
  suite.addTestSuite(MetadataFileWriterTester.class);
  suite.addTestSuite(WARCWriterProcessorTester.class);
}
Program: 89594
Project: 89594
Buggy source:
/** 
 * Computes the domain-name/byte-count and domain-name/object-count and domain-name/stopreason maps for a crawl.log.
 * @param file the local file to be processed
 * @throws IOFailure if there is problem reading the file
 */
private void parseCrawlLog(File file) throws IOFailure {
  boolean disregardSeedUrls=Settings.getBoolean(HarvesterSettings.DISREGARD_SEEDURL_INFORMATION_IN_CRAWLLOG);
  BufferedReader in=null;
  try {
    in=new BufferedReader(new FileReader(file));
    String line;
    int lineCnt=0;
    while ((line=in.readLine()) != null) {
      ++lineCnt;
      try {
        processHarvestLine(line,disregardSeedUrls);
      }
 catch (      ArgumentNotValid e) {
        final String message="String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ lineCnt+ "String_Node_Str"+ line+ "String_Node_Str";
        LOG.debug(message,e);
      }
    }
  }
 catch (  IOException e) {
    String msg="String_Node_Str" + file.getAbsolutePath() + "String_Node_Str";
    LOG.warn(msg,e);
    throw new IOFailure(msg,e);
  }
 finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
        LOG.debug("String_Node_Str" + file,e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Computes the domain-name/byte-count and domain-name/object-count and domain-name/stopreason maps for a crawl.log.
 * @param file the local file to be processed
 * @throws IOFailure if there is problem reading the file
 */
private void parseCrawlLog(File file) throws IOFailure {
  boolean disregardSeedUrls=Settings.getBoolean(HarvesterSettings.DISREGARD_SEEDURL_INFORMATION_IN_CRAWLLOG);
  BufferedReader in=null;
  try {
    in=new BufferedReader(new FileReader(file));
    String line;
    int lineCnt=0;
    while ((line=in.readLine()) != null) {
      ++lineCnt;
      try {
        processHarvestLine(line,disregardSeedUrls);
      }
 catch (      ArgumentNotValid e) {
        final String message="String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ lineCnt+ "String_Node_Str"+ line+ "String_Node_Str"+ e.getMessage();
        System.out.println(message);
        LOG.debug(message);
      }
    }
  }
 catch (  IOException e) {
    String msg="String_Node_Str" + file.getAbsolutePath() + "String_Node_Str";
    LOG.warn(msg,e);
    throw new IOFailure(msg,e);
  }
 finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
        LOG.debug("String_Node_Str" + file,e);
      }
    }
  }
}
Program: 89595
Project: 89595
Buggy source:
/** 
 * Get the number of objects found for the given domain.
 * @param domainName A domain name (as given by getDomainNames())
 * @return How many objects were collected for that domain
 * @throws ArgumentNotValid if null or empty domainName
 */
public final Long getObjectCount(String domainName){
  ArgumentNotValid.checkNotNullOrEmpty(domainName,"String_Node_Str");
  final DomainStats domainStats=domainstats.get(domainName);
  if (domainStats != null) {
    return domainStats.getObjectCount();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get the number of objects found for the given domain.
 * @param domainName A domain name (as given by getDomainNames())
 * @return How many objects were collected for that domain
 * @throws ArgumentNotValid if null or empty domainName
 */
@Override public final Long getObjectCount(String domainName){
  ArgumentNotValid.checkNotNullOrEmpty(domainName,"String_Node_Str");
  final DomainStats domainStats=domainstats.get(domainName);
  if (domainStats != null) {
    return domainStats.getObjectCount();
  }
  return null;
}
Program: 89596
Project: 89596
Buggy source:
/** 
 * Returns the set of domain names that are contained in hosts-report.txt (i.e. host names mapped to domains)
 * @return a Set of Strings
 */
public final Set<String> getDomainNames(){
  return Collections.unmodifiableSet(domainstats.keySet());
}

Fixed version (ground truth):
/** 
 * Returns the set of domain names that are contained in hosts-report.txt (i.e. host names mapped to domains)
 * @return a Set of Strings
 */
@Override public final Set<String> getDomainNames(){
  return Collections.unmodifiableSet(domainstats.keySet());
}
Program: 89597
Project: 89597
Buggy source:
/** 
 * Sort a crawl.log file according to the timestamp.
 * @param file The file containing the unsorted data.
 * @param toFile The file that the sorted data can be put into.
 * @throws IOFailure if there were errors running the sort process, orif the file does not exist.
 */
public static void sortCrawlLog(File file,File toFile){
  ArgumentNotValid.checkNotNull(file,"String_Node_Str");
  ArgumentNotValid.checkNotNull(toFile,"String_Node_Str");
  if (!file.exists()) {
    String errMsg="String_Node_Str" + file.getAbsolutePath() + "String_Node_Str";
    log.warn(errMsg);
    throw new IOFailure(errMsg);
  }
  File sortTempDir=null;
  if (Settings.getBoolean(CommonSettings.UNIX_SORT_USE_COMMON_TEMP_DIR)) {
    sortTempDir=FileUtils.getTempDir();
  }
  boolean sortLikeCrawllog=false;
  int error=ProcessUtils.runUnixSort(file,toFile,sortTempDir,sortLikeCrawllog);
  if (error != 0) {
    final String errMsg="String_Node_Str" + error + "String_Node_Str"+ file+ "String_Node_Str";
    log.warn(errMsg);
    throw new IOFailure(errMsg);
  }
}

Fixed version (ground truth):
/** 
 * Sort a crawl.log file according to the url.
 * @param file The file containing the unsorted data.
 * @param toFile The file that the sorted data can be put into.
 * @throws IOFailure if there were errors running the sort process, orif the file does not exist.
 */
public static void sortCrawlLog(File file,File toFile){
  ArgumentNotValid.checkNotNull(file,"String_Node_Str");
  ArgumentNotValid.checkNotNull(toFile,"String_Node_Str");
  if (!file.exists()) {
    String errMsg="String_Node_Str" + file.getAbsolutePath() + "String_Node_Str";
    log.warn(errMsg);
    throw new IOFailure(errMsg);
  }
  File sortTempDir=null;
  if (Settings.getBoolean(CommonSettings.UNIX_SORT_USE_COMMON_TEMP_DIR)) {
    sortTempDir=FileUtils.getTempDir();
  }
  boolean sortLikeCrawllog=true;
  int error=ProcessUtils.runUnixSort(file,toFile,sortTempDir,sortLikeCrawllog);
  if (error != 0) {
    final String errMsg="String_Node_Str" + error + "String_Node_Str"+ file+ "String_Node_Str";
    log.warn(errMsg);
    throw new IOFailure(errMsg);
  }
}
Program: 89598
Project: 89598
Buggy source:
/** 
 * Helper method to get result from a batchjob.
 * @param batchJob a certain FileBatchJob
 * @return a file with the result.
 */
private static File getResultFile(FileBatchJob batchJob){
  File f;
  File fsorted;
  try {
    final String uuid=UUID.randomUUID().toString();
    f=File.createTempFile("String_Node_Str",uuid + "String_Node_Str",FileUtils.getTempDir());
    f.deleteOnExit();
    fsorted=File.createTempFile("String_Node_Str",uuid + "String_Node_Str",FileUtils.getTempDir());
    fsorted.deleteOnExit();
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str",e);
  }
  BatchStatus status=ArcRepositoryClientFactory.getViewerInstance().batch(batchJob,Settings.get(CommonSettings.USE_REPLICA_ID));
  status.getResultFile().copyTo(f);
  FileUtils.sortCrawlLog(f,fsorted);
  FileUtils.remove(f);
  return fsorted;
}

Fixed version (ground truth):
/** 
 * Helper method to get result from a batchjob.
 * @param batchJob a certain FileBatchJob
 * @return a file with the result.
 */
private static File getResultFile(FileBatchJob batchJob){
  File f;
  File fsorted;
  try {
    final String uuid=UUID.randomUUID().toString();
    f=File.createTempFile("String_Node_Str",uuid + "String_Node_Str",FileUtils.getTempDir());
    f.deleteOnExit();
    fsorted=File.createTempFile("String_Node_Str",uuid + "String_Node_Str",FileUtils.getTempDir());
    fsorted.deleteOnExit();
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str",e);
  }
  BatchStatus status=ArcRepositoryClientFactory.getViewerInstance().batch(batchJob,Settings.get(CommonSettings.USE_REPLICA_ID));
  status.getResultFile().copyTo(f);
  FileUtils.sortCrawlLogOnTimestamp(f,fsorted);
  FileUtils.remove(f);
  return fsorted;
}
Program: 89601
Project: 89601
Buggy source:
/** 
 * On windows machines console output can cause problesms so any uses of java.util.logging.ConsoleHandler are removed.
 * @param logProperties the original contents of the logging properties file.
 * @return logging properties with the ConsoleHandler removed
 */
@Override protected String modifyLogProperties(String logProperties){
  String output;
  output=logProperties.replaceAll("String_Node_Str","String_Node_Str");
  output=output.replaceAll("String_Node_Str","String_Node_Str");
  return output;
}

Fixed version (ground truth):
/** 
 * On windows machines console output can cause problems so any uses of java.util.logging.ConsoleHandler are removed.
 * @param logProperties the original contents of the logging properties file.
 * @return logging properties with the ConsoleHandler removed
 */
@Override protected String modifyLogProperties(String logProperties){
  String output;
  output=logProperties.replaceAll("String_Node_Str","String_Node_Str");
  output=output.replaceAll("String_Node_Str","String_Node_Str");
  return output;
}
Program: 89602
Project: 89602
Buggy source:
/** 
 * Test that the BitarchiveServer outputs logging information. This verifies the fix of bug #99.
 * @throws IOException If unable to read the logfile.
 */
public void testLogging() throws IOException {
  Settings.set(ArchiveSettings.BITARCHIVE_SERVER_FILEDIR,TestInfo.BITARCHIVE_APP_DIR_1);
  Settings.set(CommonSettings.DIR_COMMONTEMPDIR,TestInfo.BITARCHIVE_SERVER_DIR_1);
  bas=BitarchiveServer.getInstance();
  bas.close();
  LogUtils.flushLogs("String_Node_Str");
  String log=FileUtils.readFile(TestInfo.LOG_FILE);
  assertFalse("String_Node_Str",log.equals("String_Node_Str"));
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",TestInfo.LOG_FILE);
}

Fixed version (ground truth):
/** 
 * Test that the BitarchiveServer outputs logging information. This verifies the fix of bug #99.
 * @throws IOException If unable to read the logfile.
 */
public void testLogging() throws IOException {
  Settings.set(ArchiveSettings.BITARCHIVE_SERVER_FILEDIR,TestInfo.BITARCHIVE_APP_DIR_1);
  Settings.set(CommonSettings.DIR_COMMONTEMPDIR,TestInfo.BITARCHIVE_SERVER_DIR_1);
  bas=BitarchiveServer.getInstance();
  bas.close();
  LogUtils.flushLogs("String_Node_Str");
  String log=FileUtils.readFile(TestInfo.LOG_FILE);
  assertFalse("String_Node_Str",log.isEmpty());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",TestInfo.LOG_FILE);
}
Program: 89603
Project: 89603
Buggy source:
/** 
 * Add the tests here.
 */
public static void addToSuite(TestSuite suite){
  suite.addTestSuite(CreateIndexTester.class);
  suite.addTestSuite(GetFileTester.class);
  suite.addTestSuite(GetRecordTester.class);
  suite.addTestSuite(ReestablishAdminDatabaseTester.class);
  suite.addTestSuite(RunBatchTester.class);
  suite.addTestSuite(UploadTester.class);
}

Fixed version (ground truth):
/** 
 * Add the tests here.
 */
public static void addToSuite(TestSuite suite){
  suite.addTestSuite(GetFileTester.class);
  suite.addTestSuite(GetRecordTester.class);
  suite.addTestSuite(ReestablishAdminDatabaseTester.class);
  suite.addTestSuite(RunBatchTester.class);
  suite.addTestSuite(UploadTester.class);
}
Program: 89606
Project: 89606
Buggy source:
/** 
 * Retrieval of the number of retries for retrieving a file from a FTP server. Returns the setting for number of retries.
 * @return The number of retries for the FTP connection, defined in settings.
 */
@Override public int getNumberOfRetries(){
  return CommonSettings.FTP_RETRIES;
}

Fixed version (ground truth):
/** 
 * Retrieval of the number of retries for retrieving a file from a FTP server. Returns the setting for number of retries.
 * @return The number of retries for the FTP connection, defined in settings.
 */
@Override public int getNumberOfRetries(){
  return FTP_RETRIES;
}
Program: 89607
Project: 89607
Buggy source:
/** 
 * Check if a given domainName is valid domain. A valid domain is an IP  address or a domain name part followed by a TLD as defined in settings.
 * @param domainName A name of a domain (netarkivet.dk)
 * @return true if domain is valid; otherwise it returns false. 
 */
public static boolean isValidDomainName(String domainName){
  ArgumentNotValid.checkNotNullOrEmpty(domainName,"String_Node_Str");
  return VALID_DOMAIN_MATCHER.matcher(domainName).matches();
}

Fixed version (ground truth):
/** 
 * Check if a given domainName is valid domain. A valid domain is an IP  address or a domain name part followed by a TLD as defined in settings.
 * @param domainName A name of a domain (netarkivet.dk)
 * @return true if domain is valid; otherwise it returns false. 
 */
public static boolean isValidDomainName(String domainName){
  ArgumentNotValid.checkNotNull(domainName,"String_Node_Str");
  return VALID_DOMAIN_MATCHER.matcher(domainName).matches();
}
Program: 89608
Project: 89608
Buggy source:
/** 
 * Utillity class, do not initialise. 
 */
private DomainUtils(){
}

Fixed version (ground truth):
/** 
 * Utility class, do not initialise. 
 */
private DomainUtils(){
}
Program: 89609
Project: 89609
Buggy source:
/** 
 * Return a domain name. A domain name is defined as either an IP address if the given host is an IP address, or a postfix of the given host name containing one hostnamepart and a TLD as defined in settings. E.g. if '.dk' and 'co.uk' are valid TLDs, www.netarchive.dk will be become netarchive.dk and news.bbc.co.uk will be come bbc.co.uk
 * @param hostname A hostname or IP address.
 * @return A domain name (foo.bar) or IP address, or null if no validhostname could be obtained from the given hostname.  If non-null, the return value is guaranteed to be a valid hostname as determined by isValidDomainName().
 */
public static String domainNameFromHostname(String hostname){
  String result=hostname;
  if (!Constants.IP_KEY_REGEXP.matcher(hostname).matches()) {
    Matcher matcher=HOSTNAME_REGEX.matcher(hostname);
    if (matcher.matches()) {
      result=matcher.group(2);
    }
  }
  if (isValidDomainName(result)) {
    return result;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return a domain name. A domain name is defined as either an IP address if the given host is an IP address, or a postfix of the given host name containing one hostnamepart and a TLD as defined in settings. E.g. if '.dk' and 'co.uk' are valid TLDs, www.netarchive.dk will be become netarchive.dk and news.bbc.co.uk will be come bbc.co.uk
 * @param hostname A hostname or IP address. Null hostname is not allowed
 * @return A domain name (foo.bar) or IP address, or null if no validdomain could be obtained from the given hostname.  If non-null, the return value is guaranteed to be a valid domain as determined by isValidDomainName().
 */
public static String domainNameFromHostname(String hostname){
  ArgumentNotValid.checkNotNull(hostname,"String_Node_Str");
  String result=hostname;
  if (!Constants.IP_KEY_REGEXP.matcher(hostname).matches()) {
    Matcher matcher=HOSTNAME_REGEX.matcher(hostname);
    if (matcher.matches()) {
      result=matcher.group(2);
    }
  }
  if (isValidDomainName(result)) {
    return result;
  }
  return null;
}
Program: 89610
Project: 89610
Buggy source:
/** 
 * Get the domain, that the given URL belongs to.
 * @param url an URL
 * @return the domain, that the given URL belongs to.
 */
private String getDomain(String url){
  try {
    URL uri=new URL(url);
    return DomainUtils.domainNameFromHostname(uri.getHost());
  }
 catch (  MalformedURLException e) {
    throw new ArgumentNotValid("String_Node_Str" + url + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Get the domain, that the given URL belongs to.
 * @param url an URL
 * @return the domain, that the given URL belongs to, or null if unable to do so.
 */
private String getDomain(String url){
  try {
    URL uri=new URL(url);
    return DomainUtils.domainNameFromHostname(uri.getHost());
  }
 catch (  MalformedURLException e) {
    throw new ArgumentNotValid("String_Node_Str" + url + "String_Node_Str");
  }
}
Program: 89611
Project: 89611
Buggy source:
/** 
 * Set the seedlist from a seedlist, where the individual seeds are separated by a '\n' character. Duplicate seeds are removed.
 * @param seedList List of seeds as one String
 */
public void setSeedList(String seedList){
  ArgumentNotValid.checkNotNullOrEmpty(seedList,"String_Node_Str");
  seedListSet=new HashSet<String>();
  BufferedReader reader=new BufferedReader(new StringReader(seedList));
  String seed;
  try {
    while ((seed=reader.readLine()) != null) {
      seedListSet.add(seed);
    }
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str",e);
  }
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str" + seedListSet.size() + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Set the seedlist of the job from the seedList argument. Individual seeds are separated by a '\n' character.  Duplicate seeds are removed.
 * @param seedList List of seeds as one String
 */
public void setSeedList(String seedList){
  ArgumentNotValid.checkNotNullOrEmpty(seedList,"String_Node_Str");
  seedListSet=new HashSet<String>();
  BufferedReader reader=new BufferedReader(new StringReader(seedList));
  String seed;
  try {
    while ((seed=reader.readLine()) != null) {
      seedListSet.add(seed);
    }
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str",e);
  }
 finally {
    IOUtils.closeQuietly(reader);
  }
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str" + seedListSet.size() + "String_Node_Str");
  }
}
Program: 89612
Project: 89612
Buggy source:
/** 
 * Returns a list of sorted seeds for this job. The sorting is by domain, and inside each domain, the list is sorted by url
 * @return a list of sorted seeds for this job.
 */
public List<String> getSortedSeedList(){
  Map<String,Set<String>> urlMap=new HashMap<String,Set<String>>();
  for (  String seed : seedListSet) {
    String url;
    if (!seed.matches(Constants.PROTOCOL_REGEXP)) {
      url="String_Node_Str" + seed;
    }
 else {
      url=seed;
    }
    String domain=getDomain(url);
    Set<String> set;
    if (urlMap.containsKey(domain)) {
      set=urlMap.get(domain);
    }
 else {
      set=new TreeSet<String>();
      urlMap.put(domain,set);
    }
    set.add(seed);
  }
  List<String> result=new ArrayList<String>();
  for (  Set<String> set : urlMap.values()) {
    result.addAll(set);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Returns a list of sorted seeds for this job. The sorting is by domain, and inside each domain, the list is sorted by url
 * @return a list of sorted seeds for this job.
 */
public List<String> getSortedSeedList(){
  Map<String,Set<String>> urlMap=new HashMap<String,Set<String>>();
  for (  String seed : seedListSet) {
    String url;
    if (!seed.matches(Constants.PROTOCOL_REGEXP)) {
      url="String_Node_Str" + seed;
    }
 else {
      url=seed;
    }
    String domain=getDomain(url);
    if (domain == null) {
      continue;
    }
    Set<String> set;
    if (urlMap.containsKey(domain)) {
      set=urlMap.get(domain);
    }
 else {
      set=new TreeSet<String>();
      urlMap.put(domain,set);
    }
    set.add(seed);
  }
  List<String> result=new ArrayList<String>();
  for (  Set<String> set : urlMap.values()) {
    result.addAll(set);
  }
  return result;
}
Program: 89613
Project: 89613
Buggy source:
/** 
 * Test method getSortedSeedList.
 */
public void testGetSortedSeedList() throws Exception {
  DomainConfiguration dc=TestInfo.getNetarkivetConfiguration();
  dc.setMaxBytes(-1);
  final int harvestNum=4;
  Job j=new Job(42L,dc,JobPriority.HIGHPRIORITY,-1L,-1L,Constants.DEFAULT_MAX_JOB_RUNNING_TIME,harvestNum);
  String seeds="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  j.setSeedList(seeds);
  List<String> list=j.getSortedSeedList();
  assertTrue(list.size() == 18);
  Set<Integer> order=new TreeSet<Integer>();
  order.add(Integer.valueOf(list.indexOf("String_Node_Str")));
  order.add(Integer.valueOf(list.indexOf("String_Node_Str")));
  order.add(Integer.valueOf(list.indexOf("String_Node_Str")));
  int last=-1;
  for (  Integer i : order) {
    if (last != -1) {
      assertTrue("String_Node_Str",i == (last + 1));
    }
    last=i;
  }
}

Fixed version (ground truth):
/** 
 * Test method getSortedSeedList.
 */
public void testGetSortedSeedList() throws Exception {
  DomainConfiguration dc=TestInfo.getNetarkivetConfiguration();
  dc.setMaxBytes(-1);
  final int harvestNum=4;
  Job j=new Job(42L,dc,JobPriority.HIGHPRIORITY,-1L,-1L,Constants.DEFAULT_MAX_JOB_RUNNING_TIME,harvestNum);
  String seeds="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  j.setSeedList(seeds);
  List<String> list=j.getSortedSeedList();
  assertTrue(list.size() == 18);
  Set<Integer> order=new TreeSet<Integer>();
  order.add(Integer.valueOf(list.indexOf("String_Node_Str")));
  order.add(Integer.valueOf(list.indexOf("String_Node_Str")));
  order.add(Integer.valueOf(list.indexOf("String_Node_Str")));
  int last=-1;
  for (  Integer i : order) {
    if (last != -1) {
      assertTrue("String_Node_Str",i == (last + 1));
    }
    last=i;
  }
  String alternateSeeds="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str";
  j.setSeedList(alternateSeeds);
  List<String> sortedSeeds=j.getSortedSeedList();
  assertTrue("String_Node_Str",sortedSeeds.size() == 2);
}
Program: 89614
Project: 89614
Buggy source:
/** 
 * Constructor. throws IllegalState if unable to initialize the database.
 */
private ReplicaCacheDatabase(){
  Connection con=ArchiveDBConnection.get();
  try {
    int retries=0;
    boolean initialized=false;
    while (retries < INIT_DB_RETRIES && !initialized) {
      retries++;
      try {
        initialiseDB(con);
        initialized=true;
        log.info("String_Node_Str");
        return;
      }
 catch (      IOFailure e) {
        log.warn("String_Node_Str" + "String_Node_Str",e);
        if (retries < INIT_DB_RETRIES) {
          log.info("String_Node_Str" + WAIT_BEFORE_INIT_RETRY + "String_Node_Str");
          waitSome();
        }
 else {
          throw new IllegalState("String_Node_Str");
        }
      }
    }
  }
  finally {
    ArchiveDBConnection.release(con);
  }
}

Fixed version (ground truth):
/** 
 * Constructor. throws IllegalState if unable to initialize the database.
 */
private ReplicaCacheDatabase(){
  Connection con=ArchiveDBConnection.get();
  try {
    int retries=0;
    boolean initialized=false;
    while (retries < INIT_DB_RETRIES && !initialized) {
      retries++;
      try {
        initialiseDB(con);
        initialized=true;
        log.info("String_Node_Str");
        return;
      }
 catch (      IOFailure e) {
        if (retries < INIT_DB_RETRIES) {
          log.info("String_Node_Str" + "String_Node_Str" + WAIT_BEFORE_INIT_RETRY + "String_Node_Str",e);
          waitSome();
        }
 else {
          throw new IllegalState("String_Node_Str");
        }
      }
    }
  }
  finally {
    ArchiveDBConnection.release(con);
  }
}
Program: 89616
Project: 89616
Buggy source:
/** 
 * Get a humanly readable representation of the file size. The number is given with 2 decimals.
 * @param aFile a File object
 * @return a humanly readable representation of the file size (rounded)
 */
public static String getHumanReadableFileSize(File aFile){
  ArgumentNotValid.checkNotNull(aFile,"String_Node_Str");
  final long bytesPerOneKilobyte=1000L;
  final long bytesPerOneMegabyte=1000000L;
  final long bytesPerOneGigabyte=1000000000L;
  double filesize=aFile.length();
  NumberFormat decFormat=new DecimalFormat("String_Node_Str");
  if (filesize < bytesPerOneKilobyte) {
    return filesize + "String_Node_Str";
  }
 else   if (filesize >= bytesPerOneKilobyte && filesize < bytesPerOneMegabyte) {
    return decFormat.format(filesize / bytesPerOneKilobyte) + "String_Node_Str";
  }
 else   if (filesize >= bytesPerOneMegabyte && filesize < bytesPerOneGigabyte) {
    return decFormat.format(filesize / bytesPerOneMegabyte) + "String_Node_Str";
  }
 else {
    return decFormat.format(filesize / bytesPerOneGigabyte) + "String_Node_Str";
  }
}

Fixed version (ground truth):
/** 
 * Get a humanly readable representation of the file size. If the file is a directory, the size is the aggregate of the files in the directory except that subdirectories are ignored. The number is given with 2 decimals.
 * @param aFile a File object
 * @return a humanly readable representation of the file size (rounded)
 */
public static String getHumanReadableFileSize(File aFile){
  ArgumentNotValid.checkNotNull(aFile,"String_Node_Str");
  final long bytesPerOneKilobyte=1000L;
  final long bytesPerOneMegabyte=1000000L;
  final long bytesPerOneGigabyte=1000000000L;
  double filesize=0L;
  if (aFile.isDirectory()) {
    for (    File f : aFile.listFiles()) {
      if (f.isFile()) {
        filesize=+f.length();
      }
    }
  }
 else {
    filesize=aFile.length();
  }
  NumberFormat decFormat=new DecimalFormat("String_Node_Str");
  if (filesize < bytesPerOneKilobyte) {
    return filesize + "String_Node_Str";
  }
 else   if (filesize >= bytesPerOneKilobyte && filesize < bytesPerOneMegabyte) {
    return decFormat.format(filesize / bytesPerOneKilobyte) + "String_Node_Str";
  }
 else   if (filesize >= bytesPerOneMegabyte && filesize < bytesPerOneGigabyte) {
    return decFormat.format(filesize / bytesPerOneMegabyte) + "String_Node_Str";
  }
 else {
    return decFormat.format(filesize / bytesPerOneGigabyte) + "String_Node_Str";
  }
}