nus-yam/ex-repair huggingface dataset:
Program: 90134
Project: 90134
Buggy source:
private void testNormalDirResponse(IndexRequestClient client,RequestType t,Set<Long> jobSet) throws IOException {
  mis.tearDown();
  mis=new MockupIndexServer(TestInfo.DUMMY_CACHEDIR);
  mis.setUp();
  mis.resetMsgList();
  mis.setResponseSuccessfull(true);
  Set<Long> jobSet2=new HashSet<Long>();
  jobSet2.addAll(jobSet);
  jobSet2.add(6L);
  List<IndexRequestMessage> sent=mis.getMsgList();
  File result=client.getIndex(jobSet2);
  assertEquals("String_Node_Str",1,sent.size());
  IndexRequestMessage msg=sent.get(0);
  assertTrue("String_Node_Str",msg.isOk());
  assertEquals("String_Node_Str",jobSet2,msg.getRequestedJobs());
  assertEquals("String_Node_Str",t,msg.getRequestType());
  assertTrue("String_Node_Str",result.isDirectory());
  assertEquals("String_Node_Str",FileUtils.readFile(mtf.working(TestInfo.DUMMY_INDEX_FILE)),FileUtils.readFile(new File(result,TestInfo.DUMMY_INDEX_FILE.getName())));
}

Fixed version (ground truth):
private void testNormalDirResponse(IndexRequestClient client,RequestType t,Set<Long> jobSet) throws IOException {
  mis.tearDown();
  mis=new MockupIndexServer(TestInfo.DUMMY_CACHEDIR);
  mis.setUp();
  mis.resetMsgList();
  mis.setResponseSuccessfull(true);
  Set<Long> jobSet2=new HashSet<Long>();
  jobSet2.addAll(jobSet);
  jobSet2.add(6L);
  List<IndexRequestMessage> sent=mis.getMsgList();
  File result=client.getIndex(jobSet2).getIndex();
  assertEquals("String_Node_Str",1,sent.size());
  IndexRequestMessage msg=sent.get(0);
  assertTrue("String_Node_Str",msg.isOk());
  assertEquals("String_Node_Str",jobSet2,msg.getRequestedJobs());
  assertEquals("String_Node_Str",t,msg.getRequestType());
  assertTrue("String_Node_Str",result.isDirectory());
  assertEquals("String_Node_Str",FileUtils.readFile(mtf.working(TestInfo.DUMMY_INDEX_FILE)),FileUtils.readFile(new File(result,TestInfo.DUMMY_INDEX_FILE.getName())));
}
Program: 90135
Project: 90135
Buggy source:
private void testNormalFileResponse(IndexRequestClient client,RequestType t,Set<Long> jobSet) throws IOException {
  mis.tearDown();
  mis=new MockupIndexServer(TestInfo.DUMMY_CACHEFILE);
  mis.setUp();
  mis.resetMsgList();
  mis.setResponseSuccessfull(true);
  File result=client.getIndex(jobSet);
  List<IndexRequestMessage> sent=mis.getMsgList();
  assertEquals("String_Node_Str",1,sent.size());
  IndexRequestMessage msg=sent.get(0);
  assertTrue("String_Node_Str",msg.isOk());
  assertEquals("String_Node_Str",jobSet,msg.getRequestedJobs());
  assertEquals("String_Node_Str",t,msg.getRequestType());
  assertEquals("String_Node_Str",FileUtils.readFile(mtf.working(TestInfo.DUMMY_INDEX_FILE)),FileUtils.readFile(result));
}

Fixed version (ground truth):
private void testNormalFileResponse(IndexRequestClient client,RequestType t,Set<Long> jobSet) throws IOException {
  mis.tearDown();
  mis=new MockupIndexServer(TestInfo.DUMMY_CACHEFILE);
  mis.setUp();
  mis.resetMsgList();
  mis.setResponseSuccessfull(true);
  File result=client.getIndex(jobSet).getIndex();
  List<IndexRequestMessage> sent=mis.getMsgList();
  assertEquals("String_Node_Str",1,sent.size());
  IndexRequestMessage msg=sent.get(0);
  assertTrue("String_Node_Str",msg.isOk());
  assertEquals("String_Node_Str",jobSet,msg.getRequestedJobs());
  assertEquals("String_Node_Str",t,msg.getRequestType());
  assertEquals("String_Node_Str",FileUtils.readFile(mtf.working(TestInfo.DUMMY_INDEX_FILE)),FileUtils.readFile(result));
}
Program: 90136
Project: 90136
Buggy source:
/** 
 * Get an index for the given list of job IDs. The resulting file contains a suitably sorted list. This method should always be safe for asynchronous calling. This method may use a cached version of the file.
 * @param jobIDs Set of job IDs to generate index for.
 * @return A file containing the index. This file must not be modified ordeleted, since it is part of the cache of data.
 */
public File getIndex(Set<Long> jobIDs);

Fixed version (ground truth):
public File getIndex(){
  return index;
}
Program: 90137
Project: 90137
Buggy source:
/** 
 * Get an index for the given list of job IDs. The resulting file contains a suitably sorted list. This method should always be safe for asynchronous calling. This method may use a cached version of the file.
 * @param jobIDs Set of job IDs to generate index for.
 * @return A file containing the index. This file must not be modified ordeleted, since it is part of the cache of data.
 */
public File getIndex(Set<Long> jobIDs){
  ArgumentNotValid.checkNotNull(jobIDs,"String_Node_Str");
  File cacheFile=new File(dir,StringUtils.conjoin("String_Node_Str",jobIDs) + "String_Node_Str" + requestType+ "String_Node_Str");
  if (jobIDs.isEmpty()) {
    cacheFile=new File(dir,"String_Node_Str" + requestType + "String_Node_Str");
  }
  if (!cacheFile.exists()) {
    log.warn("String_Node_Str" + cacheFile + "String_Node_Str"+ jobIDs);
  }
  return cacheFile;
}

Fixed version (ground truth):
/** 
 * Get an index for the given list of job IDs. The resulting file contains a suitably sorted list. This method should always be safe for asynchronous calling. This method may use a cached version of the file.
 * @param jobIDs Set of job IDs to generate index for.
 * @return A file containing the index. This file must not be modified ordeleted, since it is part of the cache of data.
 */
public JobIndex<Set<Long>> getIndex(Set<Long> jobIDs){
  ArgumentNotValid.checkNotNull(jobIDs,"String_Node_Str");
  File cacheFile=new File(dir,StringUtils.conjoin("String_Node_Str",jobIDs) + "String_Node_Str" + requestType+ "String_Node_Str");
  if (jobIDs.isEmpty()) {
    cacheFile=new File(dir,"String_Node_Str" + requestType + "String_Node_Str");
  }
  if (!cacheFile.exists()) {
    log.warn("String_Node_Str" + cacheFile + "String_Node_Str"+ jobIDs);
  }
  return new JobIndex(cacheFile,jobIDs);
}
Program: 90138
Project: 90138
Buggy source:
public void testCacheData() throws Exception {
  JobIndexCache cache=new TrivialJobIndexCache(RequestType.DEDUP_CRAWL_LOG);
  assertEquals("String_Node_Str","String_Node_Str",cache.getIndex(Collections.singleton(1L)).getName());
  TestFileUtils.copyDirectoryNonCVS(new File(TestInfo.WORKING_DIR,"String_Node_Str"),new File(new File(Settings.get(Settings.CACHE_DIR),"String_Node_Str"),"String_Node_Str"));
  Set<Long> jobs=new HashSet<Long>();
  jobs.add(2L);
  jobs.add(3L);
  assertEquals("String_Node_Str","String_Node_Str",cache.getIndex(jobs).getName());
}

Fixed version (ground truth):
public void testCacheData() throws Exception {
  JobIndexCache cache=new TrivialJobIndexCache(RequestType.DEDUP_CRAWL_LOG);
  assertEquals("String_Node_Str","String_Node_Str",cache.getIndex(Collections.singleton(1L)).getIndex().getName());
  TestFileUtils.copyDirectoryNonCVS(new File(TestInfo.WORKING_DIR,"String_Node_Str"),new File(new File(Settings.get(Settings.CACHE_DIR),"String_Node_Str"),"String_Node_Str"));
  Set<Long> jobs=new HashSet<Long>();
  jobs.add(2L);
  jobs.add(3L);
  assertEquals("String_Node_Str","String_Node_Str",cache.getIndex(jobs).getIndex().getName());
}
Program: 90139
Project: 90139
Buggy source:
public void testBuilder(){
  StringBuilder result=new StringBuilder();
  DeploymentBuilder builder=new JmxHostsDeploymentBuilder(result);
  ItConfigParser itconfigHandler=new ItConfigParser(builder);
  SAXParserFactory factory=SAXParserFactory.newInstance();
  try {
    SAXParser saxParser=factory.newSAXParser();
    saxParser.parse(TestInfo.IT_CONF_FILE,itconfigHandler);
  }
 catch (  Exception e) {
    throw new IOFailure("String_Node_Str",e);
  }
  builder.done();
}

Fixed version (ground truth):
public void testBuilder() throws DocumentException {
  StringBuilder result=new StringBuilder();
  DeploymentBuilder builder=new JmxHostsDeploymentBuilder(result);
  ItConfigParser itconfigHandler=new ItConfigParser(builder);
  SAXParserFactory factory=SAXParserFactory.newInstance();
  try {
    SAXParser saxParser=factory.newSAXParser();
    saxParser.parse(TestInfo.IT_CONF_FILE,itconfigHandler);
  }
 catch (  Exception e) {
    throw new IOFailure("String_Node_Str",e);
  }
  builder.done();
  Document d=DocumentHelper.parseText(result.toString());
  Document d2=DocumentHelper.parseText("String_Node_Str");
  d.normalize();
  d2.normalize();
  assertEquals("String_Node_Str" + "String_Node_Str",d.asXML(),d2.asXML());
}
Program: 90140
Project: 90140
Buggy source:
/** 
 * Get an index for deduplication.  This will make a call to the index server, requesting an index for the given IDs.  The files will then be cached locally. If we request index for IDs that don't exist/have problems, we get a smaller set of IDs in our cache files, and next time we ask for the same index, we will call the index server again. This will be handled well, though, because if the ids are still missing, we will get a reply telling us to use the cached smaller index anyway.
 * @param metadataEntries list of metadataEntries top get jobIDs from.
 * @return a directory  containing the index itself
 * @throws IOFailure on errors retrieving the index from the client.TODO: Better forgiving handling of no index available
 */
private File fetchDeduplicateIndex(List<MetadataEntry> metadataEntries){
  List<Long> jobIDsForDuplicateReduction=parseJobIDsForDuplicateReduction(metadataEntries);
  return IndexClientFactory.getDedupCrawllogInstance().getIndex(new HashSet<Long>(jobIDsForDuplicateReduction));
}

Fixed version (ground truth):
/** 
 * Get an index for deduplication.  This will make a call to the index server, requesting an index for the given IDs.  The files will then be cached locally. If we request index for IDs that don't exist/have problems, we get a smaller set of IDs in our cache files, and next time we ask for the same index, we will call the index server again. This will be handled well, though, because if the ids are still missing, we will get a reply telling us to use the cached smaller index anyway.
 * @param metadataEntries list of metadataEntries top get jobIDs from.
 * @return a directory  containing the index itself
 * @throws IOFailure on errors retrieving the index from the client.TODO: Better forgiving handling of no index available
 */
private File fetchDeduplicateIndex(List<MetadataEntry> metadataEntries){
  List<Long> jobIDsForDuplicateReduction=parseJobIDsForDuplicateReduction(metadataEntries);
  return IndexClientFactory.getDedupCrawllogInstance().getIndex(new HashSet<Long>(jobIDsForDuplicateReduction)).getIndex();
}
Program: 90141
Project: 90141
Buggy source:
/** 
 * Change index to use an index based on a list of jobs. Note: Does not check arguments. This is a task for the mediated classes, ArcArchiveAccess and CDXCache.
 * @param jobSet List of jobs to get an index for.
 * @param label The label this index should be known as
 */
public void changeIndex(Set<Long> jobSet,String label){
  aaa.setIndex(cc.getIndex(jobSet));
  this.jobSet=jobSet;
  this.indexLabel=label;
}

Fixed version (ground truth):
/** 
 * Change index to use an index based on a list of jobs. Note: Does not check arguments. This is a task for the mediated classes, ArcArchiveAccess and CDXCache.
 * @param jobSet List of jobs to get an index for.
 * @param label The label this index should be known as
 */
public void changeIndex(Set<Long> jobSet,String label){
  JobIndexCache.JobIndex<Set<Long>> jobindex=cc.getIndex(jobSet);
  aaa.setIndex(jobindex.getIndex());
  this.availableSet=jobindex.getAvailableJobs();
  this.jobSet=jobSet;
  this.indexLabel=label;
}
Program: 90142
Project: 90142
Buggy source:
/** 
 * Get a human readable status of the viewer proxy.
 * @return A human readable status string.
 * @param locale The locale used to generate the string
 */
public String getStatus(Locale locale){
  ArgumentNotValid.checkNotNull(locale,"String_Node_Str");
  StringBuilder status=new StringBuilder();
  if (mur.isRecordingURIs()) {
    status.append(I18N.getString(locale,"String_Node_Str"));
  }
 else {
    status.append(I18N.getString(locale,"String_Node_Str"));
  }
  status.append('\n');
  status.append(I18N.getString(locale,"String_Node_Str",mur.getRecordedURIs().size()));
  status.append('\n');
  if (jobSet == null) {
    status.append(I18N.getString(locale,"String_Node_Str"));
  }
 else {
    List<Long> jobList=new ArrayList<Long>(jobSet);
    Collections.sort(jobList);
    status.append(I18N.getString(locale,"String_Node_Str",indexLabel,StringUtils.conjoin("String_Node_Str",jobList)));
  }
  return status.toString();
}

Fixed version (ground truth):
/** 
 * Get a human readable status of the viewer proxy.
 * @return A human readable status string.
 * @param locale The locale used to generate the string
 */
public String getStatus(Locale locale){
  ArgumentNotValid.checkNotNull(locale,"String_Node_Str");
  StringBuilder status=new StringBuilder();
  if (mur.isRecordingURIs()) {
    status.append(I18N.getString(locale,"String_Node_Str"));
  }
 else {
    status.append(I18N.getString(locale,"String_Node_Str"));
  }
  status.append('\n');
  status.append(I18N.getString(locale,"String_Node_Str",mur.getRecordedURIs().size()));
  status.append('\n');
  if (jobSet == null) {
    status.append(I18N.getString(locale,"String_Node_Str"));
  }
 else {
    List<Long> availableList=new ArrayList<Long>(availableSet);
    Collections.sort(availableList);
    status.append(I18N.getString(locale,"String_Node_Str",indexLabel,StringUtils.conjoin("String_Node_Str",availableList)));
    if (!availableSet.containsAll(jobSet)) {
      Set<Long> missingSet=new HashSet<Long>(jobSet);
      missingSet.removeAll(availableSet);
      List<Long> jobList=new ArrayList<Long>(jobSet);
      Collections.sort(jobList);
      List<Long> missingList=new ArrayList<Long>(missingSet);
      Collections.sort(missingList);
      status.append('\n');
      status.append(I18N.getString(locale,"String_Node_Str",StringUtils.conjoin("String_Node_Str",jobList),StringUtils.conjoin("String_Node_Str",availableList),StringUtils.conjoin("String_Node_Str",missingList)));
    }
  }
  return status.toString();
}
Program: 90143
Project: 90143
Buggy source:
/** 
 * Get a job index for the given list of IDs.  The resulting file contains a sorted list of the CDX lines for the jobs in question. This method is safe for asynchronous calling. This method may use a cached version of the file.
 * @param jobIDs List of job IDs to generate index for.
 * @return A file containing the index.
 */
public File getIndex(Set<Long> jobIDs){
  FileUtils.createDir(CACHE_DIR);
  ArgumentNotValid.checkNotNullOrEmpty(jobIDs,"String_Node_Str");
  File indexFile=getIndexFile(jobIDs);
  File workFile=new File(indexFile.getAbsolutePath() + WORK_SUFFIX);
  workFile.deleteOnExit();
  try {
    if (workFile.createNewFile()) {
      if (indexFile.exists()) {
        return indexFile;
      }
      OutputStream tmpOutput=new FileOutputStream(workFile);
      retrieveIndex(jobIDs,tmpOutput);
      tmpOutput.close();
      ProcessUtils.runProcess(new String[]{"String_Node_Str"},"String_Node_Str",workFile.getAbsolutePath(),"String_Node_Str",indexFile.getAbsolutePath());
    }
 else {
      while (workFile.exists()) {
        try {
          Thread.sleep(SLEEP_INTERVAL);
        }
 catch (        InterruptedException e) {
          log.debug("String_Node_Str",e);
        }
      }
    }
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str",e);
  }
 finally {
    FileUtils.remove(workFile);
  }
  if (!indexFile.exists()) {
    throw new IOFailure("String_Node_Str" + jobIDs);
  }
  return indexFile;
}

Fixed version (ground truth):
/** 
 * Get a job index for the given list of IDs.  The resulting file contains a sorted list of the CDX lines for the jobs in question. This method is safe for asynchronous calling. This method may use a cached version of the file.
 * @param jobIDs List of job IDs to generate index for.
 * @return A file containing the index.
 */
public JobIndex<Set<Long>> getIndex(Set<Long> jobIDs){
  FileUtils.createDir(CACHE_DIR);
  ArgumentNotValid.checkNotNullOrEmpty(jobIDs,"String_Node_Str");
  File indexFile=getIndexFile(jobIDs);
  File workFile=new File(indexFile.getAbsolutePath() + WORK_SUFFIX);
  workFile.deleteOnExit();
  try {
    if (workFile.createNewFile()) {
      if (indexFile.exists()) {
        return new JobIndex(indexFile,jobIDs);
      }
      OutputStream tmpOutput=new FileOutputStream(workFile);
      retrieveIndex(jobIDs,tmpOutput);
      tmpOutput.close();
      ProcessUtils.runProcess(new String[]{"String_Node_Str"},"String_Node_Str",workFile.getAbsolutePath(),"String_Node_Str",indexFile.getAbsolutePath());
    }
 else {
      while (workFile.exists()) {
        try {
          Thread.sleep(SLEEP_INTERVAL);
        }
 catch (        InterruptedException e) {
          log.debug("String_Node_Str",e);
        }
      }
    }
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str",e);
  }
 finally {
    FileUtils.remove(workFile);
  }
  if (!indexFile.exists()) {
    throw new IOFailure("String_Node_Str" + jobIDs);
  }
  return new JobIndex(indexFile,jobIDs);
}
Program: 90144
Project: 90144
Buggy source:
/** 
 * Looks up a URI in our lucene index and extracts a key.
 * @param uri A URI to look for.
 * @return The file and offset where that URI can be found, or null if itdoesn't exist.
 * @throws IllegalState If a URL is found with a malformed origin field.
 * @throws IOFailure if no index is set or Lucene gives problems.
 */
private ARCKey luceneLookup(String uri){
  if (luceneSearcher == null) {
    throw new IOFailure("String_Node_Str" + uri + "String_Node_Str");
  }
  Query query=new ConstantScoreQuery(new RangeFilter(DigestIndexer.FIELD_URL,uri,uri,true,true));
  try {
    Hits hits=luceneSearcher.search(query);
    Document doc=null;
    if (hits != null) {
      log.debug("String_Node_Str" + hits.length() + "String_Node_Str"+ uri);
      for (int i=0; i < hits.length(); i++) {
        doc=hits.doc(i);
        String origin=doc.get(DigestIndexer.FIELD_ORIGIN);
        if (origin == null) {
          log.debug("String_Node_Str" + uri + "String_Node_Str"+ i);
          continue;
        }
        String[] originParts=origin.split("String_Node_Str");
        if (originParts.length != 2) {
          throw new IllegalState("String_Node_Str" + uri + "String_Node_Str"+ origin+ "String_Node_Str");
        }
        log.debug("String_Node_Str" + origin);
        return new ARCKey(originParts[0],Long.parseLong(originParts[1]));
      }
    }
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str" + uri + "String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Looks up a URI in our lucene index and extracts a key.
 * @param uri A URI to look for.
 * @return The file and offset where that URI can be found, or null if itdoesn't exist.
 * @throws IllegalState If a URL is found with a malformed origin field.
 * @throws IOFailure if no index is set or Lucene gives problems.
 */
private ARCKey luceneLookup(String uri){
  if (luceneSearcher == null) {
    throw new IOFailure("String_Node_Str" + uri + "String_Node_Str");
  }
  Query query=new ConstantScoreQuery(new SparseRangeFilter(DigestIndexer.FIELD_URL,uri,uri,true,true));
  try {
    Hits hits=luceneSearcher.search(query);
    Document doc=null;
    if (hits != null) {
      log.debug("String_Node_Str" + hits.length() + "String_Node_Str"+ uri);
      for (int i=0; i < hits.length(); i++) {
        doc=hits.doc(i);
        String origin=doc.get(DigestIndexer.FIELD_ORIGIN);
        if (origin == null) {
          log.debug("String_Node_Str" + uri + "String_Node_Str"+ i);
          continue;
        }
        String[] originParts=origin.split("String_Node_Str");
        if (originParts.length != 2) {
          throw new IllegalState("String_Node_Str" + uri + "String_Node_Str"+ origin+ "String_Node_Str");
        }
        log.debug("String_Node_Str" + origin);
        return new ARCKey(originParts[0],Long.parseLong(originParts[1]));
      }
    }
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str" + uri + "String_Node_Str",e);
  }
  return null;
}
Program: 90145
Project: 90145
Buggy source:
/** 
 * Generate a map of checksums for these file in the bitarchives.
 * @param filenames The filenames to get the checksums for.
 * @return Map containing the output of checksum jobs from the bitarchives.
 */
private Map<String,Map<Location,List<String>>> getChecksumMaps(Set<String> filenames){
  Map<String,Map<Location,List<String>>> checksummaps=new HashMap<String,Map<Location,List<String>>>();
  for (  Location ba : Location.getKnown()) {
    Map<String,List<String>> checksums=getChecksums(ba,filenames);
    log.debug("String_Node_Str" + checksums + "String_Node_Str"+ ba+ "String_Node_Str");
    for (    String filename : filenames) {
      Map<Location,List<String>> locationMap;
      if (checksummaps.containsKey(filename)) {
        locationMap=checksummaps.get(filename);
      }
 else {
        locationMap=new HashMap<Location,List<String>>();
        checksummaps.put(filename,locationMap);
      }
      locationMap.put(ba,checksums.get(filename));
    }
  }
  return checksummaps;
}

Fixed version (ground truth):
/** 
 * Generate a map of checksums for these filenames in the bitarchives.
 * @param filenames The filenames to get the checksums for.
 * @return Map containing the output of checksum jobs from the bitarchives.
 */
private Map<String,Map<Location,List<String>>> getChecksumMaps(Set<String> filenames){
  Map<String,Map<Location,List<String>>> checksummaps=new HashMap<String,Map<Location,List<String>>>();
  for (  Location ba : Location.getKnown()) {
    Map<String,List<String>> checksums=getChecksums(ba,filenames);
    log.debug("String_Node_Str" + ba + "String_Node_Str"+ StringUtils.conjoin("String_Node_Str",filenames));
    for (    String filename : filenames) {
      Map<Location,List<String>> locationMap;
      if (checksummaps.containsKey(filename)) {
        locationMap=checksummaps.get(filename);
      }
 else {
        locationMap=new HashMap<Location,List<String>>();
        checksummaps.put(filename,locationMap);
      }
      List<String> checksumsForFileOnBa=checksums.get(filename);
      if (checksumsForFileOnBa == null) {
        checksumsForFileOnBa=new ArrayList<String>();
      }
      locationMap.put(ba,checksumsForFileOnBa);
    }
  }
  return checksummaps;
}
Program: 90148
Project: 90148
Buggy source:
/** 
 * Create new instance of the preservation status for a file.  Note that this involves calls to both bitarchives, and so should not be lightly undertaken.
 * @param filename The filename to get status for
 * @param admindata The admin data for the file
 * @param checksumMap The map with the checksums for this file in all bitarchives
 * @throws ArgumentNotValid if filename is null or empty string, or if admindata is null.
 */
FilePreservationState(String filename,ArcRepositoryEntry admindata,Map<Location,List<String>> checksumMap){
  ArgumentNotValid.checkNotNullOrEmpty(filename,"String_Node_Str");
  ArgumentNotValid.checkNotNull(admindata,"String_Node_Str");
  this.filename=filename;
  adminStatus=admindata;
  bitarchive2checksum=checksumMap;
}

Fixed version (ground truth):
/** 
 * Create new instance of the preservation status for a file.
 * @param filename The filename to get status for
 * @param admindata The admin data for the file
 * @param checksumMap The map with the checksums for this file in all bitarchives
 * @throws ArgumentNotValid if filename is null or empty string, or if admindata is null.
 */
FilePreservationState(String filename,ArcRepositoryEntry admindata,Map<Location,List<String>> checksumMap){
  ArgumentNotValid.checkNotNullOrEmpty(filename,"String_Node_Str");
  ArgumentNotValid.checkNotNull(admindata,"String_Node_Str");
  this.filename=filename;
  adminStatus=admindata;
  bitarchive2checksum=checksumMap;
}
Program: 90150
Project: 90150
Buggy source:
/** 
 * Test that we can call onMessage with the expected sequence of messages for a successful crawl job.
 */
public void testOnMessageGoodJob(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=dk.netarkivet.harvester.scheduler.TestInfo.getJob();
  the_dao.create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_done=new CrawlStatusMessage(j1ID,JobStatus.DONE,hhr);
  hsms.onMessage(con.getObjectMessage(csm_done));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.DONE,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertEquals("String_Node_Str",270,dh.getSizeDataRetrieved());
  assertFalse("String_Node_Str",hist.hasNext());
}

Fixed version (ground truth):
/** 
 * Test that we can call onMessage with the expected sequence of messages for a successful crawl job.
 */
public void testOnMessageGoodJob(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=dk.netarkivet.harvester.scheduler.TestInfo.getJob();
  the_dao.create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_done=new CrawlStatusMessage(j1ID,JobStatus.DONE,hhr);
  hsms.onMessage(con.getObjectMessage(csm_done));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.DONE,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator<HarvestInfo> hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertEquals("String_Node_Str",270,dh.getSizeDataRetrieved());
  assertFalse("String_Node_Str",hist.hasNext());
}
Program: 90151
Project: 90151
Buggy source:
/** 
 * If DONE arrives after FAILED, the job should be marked FAILED.
 */
public void testDoneAfterFailed(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  the_dao.create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  CrawlStatusMessage csm_failed=new CrawlStatusMessage(j1ID,JobStatus.FAILED,null);
  csm_failed.setNotOk("String_Node_Str");
  hsms.onMessage(con.getObjectMessage(csm_failed));
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_done=new CrawlStatusMessage(j1ID,JobStatus.DONE,hhr);
  hsms.onMessage(con.getObjectMessage(csm_done));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.FAILED,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertFalse("String_Node_Str",hist.hasNext());
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertEquals("String_Node_Str",270,dh.getSizeDataRetrieved());
}

Fixed version (ground truth):
/** 
 * If DONE arrives after FAILED, the job should be marked FAILED.
 */
public void testDoneAfterFailed(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  the_dao.create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  CrawlStatusMessage csm_failed=new CrawlStatusMessage(j1ID,JobStatus.FAILED,null);
  csm_failed.setNotOk("String_Node_Str");
  hsms.onMessage(con.getObjectMessage(csm_failed));
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_done=new CrawlStatusMessage(j1ID,JobStatus.DONE,hhr);
  hsms.onMessage(con.getObjectMessage(csm_done));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.FAILED,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator<HarvestInfo> hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertFalse("String_Node_Str",hist.hasNext());
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertEquals("String_Node_Str",270,dh.getSizeDataRetrieved());
}
Program: 90152
Project: 90152
Buggy source:
/** 
 * Tests what happens if a FAILED message arrives with a crawl report. The behavioour should be identical to the case with a DONE message.
 */
public void testOnMessageFailedJobWithReport(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  JobDAO.getInstance().create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_failed=new CrawlStatusMessage(j1ID,JobStatus.FAILED,hhr);
  csm_failed.setNotOk("String_Node_Str");
  hsms.onMessage(con.getObjectMessage(csm_failed));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.FAILED,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertFalse("String_Node_Str",hist.hasNext());
}

Fixed version (ground truth):
/** 
 * Tests what happens if a FAILED message arrives with a crawl report. The behavior should be identical to the case with a DONE message.
 */
public void testOnMessageFailedJobWithReport(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  JobDAO.getInstance().create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_failed=new CrawlStatusMessage(j1ID,JobStatus.FAILED,hhr);
  csm_failed.setNotOk("String_Node_Str");
  hsms.onMessage(con.getObjectMessage(csm_failed));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.FAILED,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator<HarvestInfo> hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertFalse("String_Node_Str",hist.hasNext());
}
Program: 90153
Project: 90153
Buggy source:
/** 
 * Send a STARTED message after a DONE message. The STARTED message should be ignored.
 */
public void testStartedAfterDone(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  JobDAO.getInstance().create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_done=new CrawlStatusMessage(j1ID,JobStatus.DONE,hhr);
  hsms.onMessage(con.getObjectMessage(csm_done));
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.DONE,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertFalse("String_Node_Str",hist.hasNext());
  LogUtils.flushLogs(hsms.getClass().getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",LOG_FILE);
}

Fixed version (ground truth):
/** 
 * Send a STARTED message after a DONE message. The STARTED message should be ignored.
 */
public void testStartedAfterDone(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  JobDAO.getInstance().create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_done=new CrawlStatusMessage(j1ID,JobStatus.DONE,hhr);
  hsms.onMessage(con.getObjectMessage(csm_done));
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.DONE,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator<HarvestInfo> hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertFalse("String_Node_Str",hist.hasNext());
  LogUtils.flushLogs(hsms.getClass().getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",LOG_FILE);
}
Program: 90154
Project: 90154
Buggy source:
/** 
 * Send a STARTED CrawlStatusMessage after a Failed message. This STARTED message should be ignored.
 */
public void testStartedAfterFailed(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  JobDAO.getInstance().create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_failed=new CrawlStatusMessage(j1ID,JobStatus.FAILED,hhr);
  csm_failed.setNotOk("String_Node_Str");
  hsms.onMessage(con.getObjectMessage(csm_failed));
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.FAILED,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertFalse("String_Node_Str",hist.hasNext());
}

Fixed version (ground truth):
/** 
 * Send a STARTED CrawlStatusMessage after a Failed message. This STARTED message should be ignored.
 */
public void testStartedAfterFailed(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  JobDAO.getInstance().create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_failed=new CrawlStatusMessage(j1ID,JobStatus.FAILED,hhr);
  csm_failed.setNotOk("String_Node_Str");
  hsms.onMessage(con.getObjectMessage(csm_failed));
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.FAILED,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator<HarvestInfo> hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertFalse("String_Node_Str",hist.hasNext());
}
Program: 90156
Project: 90156
Buggy source:
/** 
 * Test that receiving a "DONE" directly after a "SUBMITTED" runs ok but is logged.
 */
public void testDoneAfterSubmitted(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  the_dao.create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_done=new CrawlStatusMessage(j1ID,JobStatus.DONE,hhr);
  hsms.onMessage(con.getObjectMessage(csm_done));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.DONE,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertFalse("String_Node_Str",hist.hasNext());
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertEquals("String_Node_Str",270,dh.getSizeDataRetrieved());
  LogUtils.flushLogs(hsms.getClass().getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",LOG_FILE);
}

Fixed version (ground truth):
/** 
 * Test that receiving a "DONE" directly after a "SUBMITTED" runs ok but is logged.
 */
public void testDoneAfterSubmitted(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  the_dao.create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_done=new CrawlStatusMessage(j1ID,JobStatus.DONE,hhr);
  hsms.onMessage(con.getObjectMessage(csm_done));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.DONE,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator<HarvestInfo> hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertFalse("String_Node_Str",hist.hasNext());
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertEquals("String_Node_Str",270,dh.getSizeDataRetrieved());
  LogUtils.flushLogs(hsms.getClass().getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",LOG_FILE);
}
Program: 90157
Project: 90157
Buggy source:
/** 
 * Print a table row with current state of a file in a given bitarchive.
 * @param out    The stream to print state to.
 * @param l      The location of the files.
 * @param fs     The file preservation state for that file.
 * @param locale Locale of the labels.
 * @throws IOException
 */
private static void printFileStateForBitarchive(JspWriter out,Location l,FilePreservationState fs,Locale locale) throws IOException {
  String baLocation=l.getName();
  out.print(HTMLUtils.makeTableRow(HTMLUtils.makeTableElement(baLocation),HTMLUtils.makeTableElement(fs.getAdminBitarchiveState(l)),HTMLUtils.makeTableElement(presentChecksum(fs.getBitarchiveChecksum(l),locale))));
}

Fixed version (ground truth):
/** 
 * Print a table row with current state of a file in a given bitarchive.
 * @param out    The stream to print state to.
 * @param baLocation The location of the files.
 * @param fs     The file preservation state for that file.
 * @param locale Locale of the labels.
 * @throws IOException
 */
private static void printFileStateForBitarchive(JspWriter out,Location baLocation,FilePreservationState fs,Locale locale) throws IOException {
  log.debug("String_Node_Str" + baLocation.getName() + "String_Node_Str");
  if (fs.getBitarchiveChecksum(baLocation) == null) {
    log.fatal("String_Node_Str" + baLocation);
  }
  out.print(HTMLUtils.makeTableRow(HTMLUtils.makeTableElement(baLocation.getName()),HTMLUtils.makeTableElement(fs.getAdminBitarchiveState(baLocation)),HTMLUtils.makeTableElement(presentChecksum(fs.getBitarchiveChecksum(baLocation),locale))));
}
Program: 90158
Project: 90158
Buggy source:
/** 
 * Present a list of checksums in a human-readable form.
 * @param csum   List of checksum strings
 * @param locale
 * @return String presenting the checksums.
 */
public static String presentChecksum(List<String> csum,Locale locale){
  ArgumentNotValid.checkNotNull(csum,"String_Node_Str");
  ArgumentNotValid.checkNotNull(locale,"String_Node_Str");
  String csumString=csum.toString();
  if (csum.isEmpty()) {
    csumString=I18N.getString(locale,"String_Node_Str");
  }
 else   if (csum.size() == 1) {
    csumString=csum.get(0);
  }
  return csumString;
}

Fixed version (ground truth):
/** 
 * Present a list of checksums in a human-readable form. If size of list is 0, it returns "No checksum". If size of list is 1, it returns the one available checksum. Otherwise, it returns toString of the list. 
 * @param csum   List of checksum strings
 * @param locale The given locale.
 * @return String presenting the checksums.
 */
public static String presentChecksum(List<String> csum,Locale locale){
  ArgumentNotValid.checkNotNull(csum,"String_Node_Str");
  ArgumentNotValid.checkNotNull(locale,"String_Node_Str");
  String csumString=csum.toString();
  if (csum.isEmpty()) {
    csumString=I18N.getString(locale,"String_Node_Str");
  }
 else   if (csum.size() == 1) {
    csumString=csum.get(0);
  }
  return csumString;
}
Program: 90159
Project: 90159
Buggy source:
/** 
 * Writes the files involved with a harvests.
 * @param crawldir        The directory that the crawl should take placein.
 * @param job             The Job object containing various harvest setupdata.
 * @param metadataEntries Any metadata entries sent along with the job thatshould be stored for later use.
 * @return An object encapsulating where these files have been written.
 */
public HeritrixFiles writeHarvestFiles(File crawldir,Job job,List<MetadataEntry> metadataEntries){
  final HeritrixFiles files=new HeritrixFiles(crawldir,job.getJobID(),job.getOrigHarvestDefinitionID());
  log.debug("String_Node_Str" + job.getJobID());
  new PersistentJobData(files.getCrawlDir()).write(job);
  writePreharvestMetadata(job,metadataEntries,crawldir);
  files.writeSeedsTxt(job.getSeedListAsString());
  files.writeOrderXml(job.getOrderXMLdoc());
  files.setIndexDir(fetchDeduplicateIndex(metadataEntries));
  return files;
}

Fixed version (ground truth):
/** 
 * Writes the files involved with a harvests.
 * @param crawldir        The directory that the crawl should take placein.
 * @param job             The Job object containing various harvest setupdata.
 * @param metadataEntries Any metadata entries sent along with the job thatshould be stored for later use.
 * @return An object encapsulating where these files have been written.
 */
public HeritrixFiles writeHarvestFiles(File crawldir,Job job,List<MetadataEntry> metadataEntries){
  final HeritrixFiles files=new HeritrixFiles(crawldir,job.getJobID(),job.getOrigHarvestDefinitionID());
  log.debug("String_Node_Str" + job.getJobID());
  new PersistentJobData(files.getCrawlDir()).write(job);
  writePreharvestMetadata(job,metadataEntries,crawldir);
  files.writeSeedsTxt(job.getSeedListAsString());
  files.writeOrderXml(job.getOrderXMLdoc());
  files.setIndexDir(fetchDeduplicateIndex(metadataEntries));
  boolean created=files.getArcsDir().mkdir();
  if (!created) {
    log.warn("String_Node_Str" + files.getArcsDir());
  }
  return files;
}
Program: 90164
Project: 90164
Buggy source:
/** 
 * @param objectCount The objectCount to set.
 * @throws ArgumentNotValid If objectCount is a negative number.
 */
public void setObjectCount(long objectCount){
  ArgumentNotValid.checkNotNegative(objectCount,"String_Node_Str");
  this.objectCount=objectCount;
}

Fixed version (ground truth):
/** 
 * Set objectcount to something new.
 * @param objectCount The objectCount to set.
 * @throws ArgumentNotValid If objectCount is a negative number.
 */
public void setObjectCount(long objectCount){
  ArgumentNotValid.checkNotNegative(objectCount,"String_Node_Str");
  this.objectCount=objectCount;
}
Program: 90165
Project: 90165
Buggy source:
/** 
 * Constructor for a DomainStats object.
 * @param initObjectCount Start counting objects from this number
 * @param initByteCount  Start counting bytes from this number
 * @param defaultStopReason The default StopReason for a given domain.
 * @throws ArgumentNotValid If initObjectCount < 0, initByteCount < 0, ordefaultStopReason is null.
 */
public DomainStats(long initObjectCount,long initByteCount,StopReason defaultStopReason){
  ArgumentNotValid.checkNotNegative(initByteCount,"String_Node_Str");
  ArgumentNotValid.checkNotNegative(objectCount,"String_Node_Str");
  ArgumentNotValid.checkNotNull(defaultStopReason,"String_Node_Str");
  this.objectCount=initObjectCount;
  this.byteCount=initByteCount;
  this.stopReason=defaultStopReason;
}

Fixed version (ground truth):
/** 
 * Constructor for a DomainStats object.
 * @param initObjectCount Start counting objects from this number
 * @param initByteCount  Start counting bytes from this number
 * @param defaultStopReason The default StopReason for a given domain.
 * @throws ArgumentNotValid If initObjectCount < 0, initByteCount < 0, ordefaultStopReason is null.
 */
public DomainStats(long initObjectCount,long initByteCount,StopReason defaultStopReason){
  ArgumentNotValid.checkNotNegative(initObjectCount,"String_Node_Str");
  ArgumentNotValid.checkNotNegative(initByteCount,"String_Node_Str");
  ArgumentNotValid.checkNotNull(defaultStopReason,"String_Node_Str");
  this.objectCount=initObjectCount;
  this.byteCount=initByteCount;
  this.stopReason=defaultStopReason;
}