nus-yam/ex-repair huggingface dataset:
Program: 89618
Project: 89618
Buggy source:
/** 
 * Test of preparecombine.
 * @throws Exception
 */
public void testPrepareCombine() throws NoSuchFieldException, IllegalAccessException {
  CrawlLogIndexCache cache=new FullCrawlLogIndexCache();
  ReflectUtils.getPrivateField(CrawlLogIndexCache.class,"String_Node_Str").set(cache,new CDXDataCache(){
    public Long cache(    long ID){
      if (ID % 3 == 0) {
        return null;
      }
 else {
        return ID;
      }
    }
  }
);
  ReflectUtils.getPrivateField(CombiningMultiFileBasedCache.class,"String_Node_Str").set(cache,new CrawlLogDataCache(){
    public File getCacheFile(    Long id){
      return new File(TestInfo.WORKING_DIR,"String_Node_Str" + id);
    }
    protected Long cacheData(    Long id){
      return null;
    }
  }
);
  Set<Long> jobIDs=new HashSet<Long>();
  jobIDs.add(1L);
  cache.prepareCombine(jobIDs);
  LogUtils.flushLogs(CrawlLogIndexCache.class.getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str" + jobIDs.size() + "String_Node_Str"+ jobIDs,TestInfo.LOG_FILE);
}

Fixed version (ground truth):
/** 
 * Test of preparecombine.
 * @throws Exception
 */
public void testPrepareCombine() throws NoSuchFieldException, IllegalAccessException {
  CrawlLogIndexCache cache=new FullCrawlLogIndexCache();
  ReflectUtils.getPrivateField(CrawlLogIndexCache.class,"String_Node_Str").set(cache,new CDXDataCache(){
    public Long cache(    Long ID){
      if (ID % 3 == 0) {
        return null;
      }
 else {
        return ID;
      }
    }
  }
);
  ReflectUtils.getPrivateField(CombiningMultiFileBasedCache.class,"String_Node_Str").set(cache,new CrawlLogDataCache(){
    public File getCacheFile(    Long id){
      return new File(TestInfo.WORKING_DIR,"String_Node_Str" + id);
    }
    protected Long cacheData(    Long id){
      return null;
    }
  }
);
  Set<Long> jobIDs=new HashSet<Long>();
  jobIDs.add(1L);
  cache.prepareCombine(jobIDs);
  LogUtils.flushLogs(CrawlLogIndexCache.class.getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str" + jobIDs.size() + "String_Node_Str"+ jobIDs,TestInfo.LOG_FILE);
}
Program: 89619
Project: 89619
Buggy source:
public Long cache(long ID){
  if (ID % 3 == 0) {
    return null;
  }
 else {
    return ID;
  }
}

Fixed version (ground truth):
public Long cache(Long ID){
  if (ID % 3 == 0) {
    return null;
  }
 else {
    return ID;
  }
}
Program: 89620
Project: 89620
Buggy source:
public GetListener(String arcFileName,long offset){
  this.arcFileName=arcFileName;
  this.offset=offset;
  try {
    HashMap<String,Object> map=new HashMap<String,Object>();
    for (    Object o : ARCConstants.REQUIRED_VERSION_1_HEADER_FIELDS) {
      map.put((String)o,Integer.toString(CONTENT.length()));
    }
    map.put(ARCConstants.ABSOLUTE_OFFSET_KEY,new Long(0L));
    ARCRecordMetaData meta=new ARCRecordMetaData("String_Node_Str",map);
    InputStream is=new ByteArrayInputStream(CONTENT.getBytes());
    myRec=new ARCRecord(is,meta,0,false,false,false);
  }
 catch (  IOException e) {
    myRec=null;
  }
}

Fixed version (ground truth):
public GetListener(String arcFileName,long offset){
  this.arcFileName=arcFileName;
  this.offset=offset;
  try {
    HashMap<String,Object> map=new HashMap<String,Object>();
    for (    Object o : ARCConstants.REQUIRED_VERSION_1_HEADER_FIELDS) {
      map.put((String)o,Integer.toString(CONTENT.length()));
    }
    map.put(ARCConstants.ABSOLUTE_OFFSET_KEY,Long.valueOf(0L));
    ARCRecordMetaData meta=new ARCRecordMetaData("String_Node_Str",map);
    InputStream is=new ByteArrayInputStream(CONTENT.getBytes());
    myRec=new ARCRecord(is,meta,0,false,false,false);
  }
 catch (  IOException e) {
    myRec=null;
  }
}
Program: 89621
Project: 89621
Buggy source:
/** 
 * Get the singleton, and initialise it if it is new.
 * @return A JMSConnection
 */
public static JMSConnection getInstance(){
  if (instance == null) {
    instance=new JMSConnectionMockupMQ();
    instance.initConnection();
  }
  return instance;
}

Fixed version (ground truth):
/** 
 * Get the singleton, and initialise it if it is new.
 * @return A JMSConnection
 */
public static synchronized JMSConnection getInstance(){
  if (instance == null) {
    instance=new JMSConnectionMockupMQ();
    instance.initConnection();
  }
  return instance;
}
Program: 89622
Project: 89622
Buggy source:
/** 
 * Returns an OK BitarchiveRecord. Content is simply arcfile name and index encoded in a stream. 
 */
public BitarchiveRecord get(String arcFile,long index){
  final Map<String,Object> metadata=new HashMap<String,Object>();
  for (  String header_field : (List<String>)ARCConstants.REQUIRED_VERSION_1_HEADER_FIELDS) {
    metadata.put(header_field,"String_Node_Str");
  }
  metadata.put(ARCConstants.ABSOLUTE_OFFSET_KEY,new Long(0L));
  byte[] data=("String_Node_Str" + arcFile + "String_Node_Str"+ arcFile+ "String_Node_Str"+ index).getBytes();
  metadata.put(ARCConstants.LENGTH_FIELD_KEY,Integer.toString(data.length));
  try {
    ARCRecordMetaData meta=new ARCRecordMetaData(arcFile,metadata);
    return new BitarchiveRecord(new ARCRecord(new ByteArrayInputStream(data),meta),arcFile);
  }
 catch (  IOException e) {
    fail("String_Node_Str");
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns an OK BitarchiveRecord. Content is simply arcfile name and index encoded in a stream. 
 */
public BitarchiveRecord get(String arcFile,long index){
  final Map<String,Object> metadata=new HashMap<String,Object>();
  for (  String header_field : (List<String>)ARCConstants.REQUIRED_VERSION_1_HEADER_FIELDS) {
    metadata.put(header_field,"String_Node_Str");
  }
  metadata.put(ARCConstants.ABSOLUTE_OFFSET_KEY,Long.valueOf(0L));
  byte[] data=("String_Node_Str" + arcFile + "String_Node_Str"+ arcFile+ "String_Node_Str"+ index).getBytes();
  metadata.put(ARCConstants.LENGTH_FIELD_KEY,Integer.toString(data.length));
  try {
    ARCRecordMetaData meta=new ARCRecordMetaData(arcFile,metadata);
    return new BitarchiveRecord(new ARCRecord(new ByteArrayInputStream(data),meta),arcFile);
  }
 catch (  IOException e) {
    fail("String_Node_Str");
    return null;
  }
}
Program: 89623
Project: 89623
Buggy source:
/** 
 * Test that files larger than 2GB can be copied! 
 */
public void testCopyLargeFiles() throws IOException {
  byte[] block=new byte[BLOCKSIZE];
  SUBDIR.mkdirs();
  File largeFile=new File(SUBDIR,LARGE_FILE);
  OutputStream os=new BufferedOutputStream(new FileOutputStream(largeFile));
  System.out.println("String_Node_Str");
  for (long l=0; l < LARGE / ((long)BLOCKSIZE) + 1L; l++) {
    os.write(block);
  }
  System.out.println("String_Node_Str");
  FileUtils.copyDirectory(SUBDIR,SUBDIR2);
  File file1=new File(SUBDIR,LARGE_FILE);
  File file2=new File(SUBDIR2,LARGE_FILE);
  assertEquals("String_Node_Str",file1.length(),file2.length());
}

Fixed version (ground truth):
/** 
 * Test that files larger than 2GB can be copied! 
 */
public void testCopyLargeFiles() throws IOException {
  byte[] block=new byte[BLOCKSIZE];
  SUBDIR.mkdirs();
  File largeFile=new File(SUBDIR,LARGE_FILE);
  OutputStream os=null;
  try {
    os=new BufferedOutputStream(new FileOutputStream(largeFile));
    System.out.println("String_Node_Str");
    for (long l=0; l < LARGE / ((long)BLOCKSIZE) + 1L; l++) {
      os.write(block);
    }
    System.out.println("String_Node_Str");
    FileUtils.copyDirectory(SUBDIR,SUBDIR2);
    File file1=new File(SUBDIR,LARGE_FILE);
    File file2=new File(SUBDIR2,LARGE_FILE);
    assertEquals("String_Node_Str",file1.length(),file2.length());
  }
  finally {
    IOUtils.closeQuietly(os);
  }
}
Program: 89624
Project: 89624
Buggy source:
/** 
 * Test that files larger than 2GB can be gzipped and gunzipped! 
 */
public void testGZipGUnZipLargeFiles() throws IOException {
  byte[] block=new byte[BLOCKSIZE];
  SUBDIR.mkdirs();
  File largeFile=new File(SUBDIR,LARGE_FILE);
  OutputStream os=new FileOutputStream(largeFile);
  System.out.println("String_Node_Str");
  for (long l=0; l < LARGE / ((long)BLOCKSIZE) + 1L; l++) {
    os.write(block);
  }
  System.out.println("String_Node_Str");
  ZipUtils.gzipFiles(SUBDIR,SUBDIR2);
  System.out.println("String_Node_Str");
  ZipUtils.gunzipFiles(SUBDIR2,SUBDIR3);
  File file1=new File(SUBDIR,LARGE_FILE);
  File file2=new File(SUBDIR3,LARGE_FILE);
  assertEquals("String_Node_Str",file1.length(),file2.length());
}

Fixed version (ground truth):
/** 
 * Test that files larger than 2GB can be gzipped and gunzipped! 
 */
public void testGZipGUnZipLargeFiles() throws IOException {
  byte[] block=new byte[BLOCKSIZE];
  SUBDIR.mkdirs();
  File largeFile=new File(SUBDIR,LARGE_FILE);
  OutputStream os=null;
  try {
    os=new FileOutputStream(largeFile);
    System.out.println("String_Node_Str");
    for (long l=0; l < LARGE / ((long)BLOCKSIZE) + 1L; l++) {
      os.write(block);
    }
    System.out.println("String_Node_Str");
    ZipUtils.gzipFiles(SUBDIR,SUBDIR2);
    System.out.println("String_Node_Str");
    ZipUtils.gunzipFiles(SUBDIR2,SUBDIR3);
    File file1=new File(SUBDIR,LARGE_FILE);
    File file2=new File(SUBDIR3,LARGE_FILE);
    assertEquals("String_Node_Str",file1.length(),file2.length());
  }
  finally {
    IOUtils.closeQuietly(os);
  }
}
Program: 89625
Project: 89625
Buggy source:
/** 
 * Test the dk.netarkivet.common.utils.arc.BatchFilter.getMimetypeBatchFilter Test the validity of the given mimetype
 */
public void testGetMimetype(){
  String invalidMimetype=new String("String_Node_Str");
  String validMimetype="String_Node_Str";
  ARCBatchFilter cfilter=null;
  try {
    cfilter=ARCBatchFilter.getMimetypeBatchFilter(invalidMimetype);
    fail("String_Node_Str" + invalidMimetype);
  }
 catch (  MimeTypeParseException e) {
  }
  try {
    cfilter=ARCBatchFilter.getMimetypeBatchFilter(validMimetype);
  }
 catch (  MimeTypeParseException e) {
    fail("String_Node_Str" + validMimetype);
  }
catch (  Exception e) {
    fail("String_Node_Str" + e + "String_Node_Str"+ validMimetype);
  }
  assertTrue("String_Node_Str",cfilter != null);
  assertEquals(cfilter.getName(),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test the dk.netarkivet.common.utils.arc.BatchFilter.getMimetypeBatchFilter Test the validity of the given mimetype
 */
public void testGetMimetype(){
  String invalidMimetype="String_Node_Str";
  String validMimetype="String_Node_Str";
  ARCBatchFilter cfilter=null;
  try {
    cfilter=ARCBatchFilter.getMimetypeBatchFilter(invalidMimetype);
    fail("String_Node_Str" + invalidMimetype);
  }
 catch (  MimeTypeParseException e) {
  }
  try {
    cfilter=ARCBatchFilter.getMimetypeBatchFilter(validMimetype);
  }
 catch (  MimeTypeParseException e) {
    fail("String_Node_Str" + validMimetype);
  }
catch (  Exception e) {
    fail("String_Node_Str" + e + "String_Node_Str"+ validMimetype);
  }
  assertTrue("String_Node_Str",cfilter != null);
  assertEquals(cfilter.getName(),"String_Node_Str");
}
Program: 89626
Project: 89626
Buggy source:
@Override public boolean processFile(File file,OutputStream os){
  try {
    os.write(new String(file.getName() + "String_Node_Str").getBytes());
  }
 catch (  Exception e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean processFile(File file,OutputStream os){
  try {
    os.write((file.getName() + "String_Node_Str").getBytes());
  }
 catch (  Exception e) {
    return false;
  }
  return true;
}
Program: 89627
Project: 89627
Buggy source:
@Override public boolean processFile(File file,OutputStream os){
  try {
    os.write(new String(file.getName() + "String_Node_Str").getBytes());
  }
 catch (  Exception e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean processFile(File file,OutputStream os){
  try {
    os.write((file.getName() + "String_Node_Str").getBytes());
  }
 catch (  Exception e) {
    return false;
  }
  return true;
}
Program: 89628
Project: 89628
Buggy source:
@Override public boolean postProcess(InputStream input,OutputStream output){
  Log log=LogFactory.getLog(this.getClass());
  try {
    List<String> filenames=new ArrayList<String>();
    log.info("String_Node_Str");
    BufferedReader br=new BufferedReader(new InputStreamReader(input));
    String line;
    while ((line=br.readLine()) != null) {
      filenames.add(line);
    }
    log.info("String_Node_Str");
    Collections.sort(filenames);
    for (    String file : filenames) {
      output.write(file.getBytes());
      output.write(new String("String_Node_Str").getBytes());
    }
    return true;
  }
 catch (  Exception e) {
    log.warn(e.getMessage());
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean postProcess(InputStream input,OutputStream output){
  Log log=LogFactory.getLog(this.getClass());
  try {
    List<String> filenames=new ArrayList<String>();
    log.info("String_Node_Str");
    BufferedReader br=new BufferedReader(new InputStreamReader(input));
    String line;
    while ((line=br.readLine()) != null) {
      filenames.add(line);
    }
    log.info("String_Node_Str");
    Collections.sort(filenames);
    for (    String file : filenames) {
      output.write(file.getBytes());
      output.write("String_Node_Str".getBytes());
    }
    return true;
  }
 catch (  Exception e) {
    log.warn(e.getMessage());
    return false;
  }
}
Program: 89629
Project: 89629
Buggy source:
@Override public void finish(OutputStream os){
  try {
    os.write(new String("String_Node_Str").getBytes());
    os.write(new String("String_Node_Str" + urlCount + "String_Node_Str").getBytes());
    os.write(new String("String_Node_Str" + mimeCount + "String_Node_Str").getBytes());
    os.write(new String("String_Node_Str" + bothCount + "String_Node_Str").getBytes());
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str" + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void finish(OutputStream os){
  try {
    os.write("String_Node_Str".getBytes());
    os.write(("String_Node_Str" + urlCount + "String_Node_Str").getBytes());
    os.write(("String_Node_Str" + mimeCount + "String_Node_Str").getBytes());
    os.write(("String_Node_Str" + bothCount + "String_Node_Str").getBytes());
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str" + "String_Node_Str",e);
  }
}
Program: 89630
Project: 89630
Buggy source:
@Override public void processRecord(ARCRecord record,OutputStream os){
  totalCount++;
  boolean valid=true;
  if (record.getMetaData().getUrl().matches(regex)) {
    urlCount++;
  }
 else {
    valid=false;
  }
  if (record.getMetaData().getMimetype().matches(mimetype)) {
    mimeCount++;
  }
 else {
    valid=false;
  }
  if (valid) {
    bothCount++;
    try {
      os.write(new String(record.getMetaData().getUrl() + "String_Node_Str" + record.getMetaData().getMimetype()+ "String_Node_Str").getBytes());
    }
 catch (    IOException e) {
      throw new IOFailure("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void processRecord(ARCRecord record,OutputStream os){
  totalCount++;
  boolean valid=true;
  if (record.getMetaData().getUrl().matches(regex)) {
    urlCount++;
  }
 else {
    valid=false;
  }
  if (record.getMetaData().getMimetype().matches(mimetype)) {
    mimeCount++;
  }
 else {
    valid=false;
  }
  if (valid) {
    bothCount++;
    try {
      os.write((record.getMetaData().getUrl() + "String_Node_Str" + record.getMetaData().getMimetype()+ "String_Node_Str").getBytes());
    }
 catch (    IOException e) {
      throw new IOFailure("String_Node_Str",e);
    }
  }
}
Program: 89633
Project: 89633
Buggy source:
public static void assertEquals(Set<Object> expectedSet,Set<Object> resultSet){
  Set<Object> disjunctInExpectedSet=new HashSet<Object>(expectedSet);
  disjunctInExpectedSet.removeAll(resultSet);
  Set<Object> disjunctInResultSet=new HashSet<Object>(resultSet);
  disjunctInResultSet.removeAll(expectedSet);
  if (!disjunctInExpectedSet.isEmpty() || !disjunctInResultSet.isEmpty()) {
    fail("String_Node_Str" + disjunctInExpectedSet.size() + "String_Node_Str"+ "String_Node_Str"+ disjunctInExpectedSet+ "String_Node_Str"+ disjunctInResultSet.size+ "String_Node_Str"+ "String_Node_Str"+ disjunctInResultSet);
  }
}

Fixed version (ground truth):
public static void assertEquals(Set<Object> expectedSet,Set<Object> resultSet){
  Set<Object> disjunctInExpectedSet=new HashSet<Object>(expectedSet);
  disjunctInExpectedSet.removeAll(resultSet);
  Set<Object> disjunctInResultSet=new HashSet<Object>(resultSet);
  disjunctInResultSet.removeAll(expectedSet);
  if (!disjunctInExpectedSet.isEmpty() || !disjunctInResultSet.isEmpty()) {
    fail("String_Node_Str" + disjunctInExpectedSet.size() + "String_Node_Str"+ "String_Node_Str"+ disjunctInExpectedSet+ "String_Node_Str"+ disjunctInResultSet.size()+ "String_Node_Str"+ "String_Node_Str"+ disjunctInResultSet);
  }
}
Program: 89635
Project: 89635
Buggy source:
/** 
 * Check if a harvestdefinition exists with the given id.
 * @param c An open connection to the harvestDatabase
 * @param oid A potentiel identifier for a harvestdefinition
 * @return true If a harvestdefinition exists with the given id.
 * @see HarvestDefinitionDAO#exists(Long)
 */
private boolean exists(Connection c,Long oid){
  return 1 == DBUtils.selectIntValue(c,"String_Node_Str" + "String_Node_Str",oid);
}

Fixed version (ground truth):
/** 
 * Check if a harvestdefinition exists with the given id.
 * @param c An open connection to the harvestDatabase
 * @param oid A potential identifier for a harvestdefinition
 * @return true If a harvestdefinition exists with the given id.
 * @see HarvestDefinitionDAO#exists(Long)
 */
private boolean exists(Connection c,Long oid){
  return 1 == DBUtils.selectIntValue(c,"String_Node_Str" + "String_Node_Str",oid);
}
Program: 89636
Project: 89636
Buggy source:
/** 
 * saves all extended Field values for a Domain in the Database.
 * @param c Connection to Database
 * @param d Domain where loaded extended Field Values will be set
 * @throws SQLException If database errors occur.
 */
private void saveExtendedFieldValues(Connection c,Domain d) throws SQLException {
  List<ExtendedFieldValue> list=d.getExtendedFieldValues();
  for (int i=0; i < list.size(); i++) {
    ExtendedFieldValue efv=list.get(i);
    efv.setInstanceID(d.getID());
    ExtendedFieldValueDBDAO dao=new ExtendedFieldValueDBDAO();
    if (efv.getExtendedFieldValueID() != null) {
      dao.update(c,efv,false);
    }
 else {
      dao.create(c,efv,false);
    }
  }
}

Fixed version (ground truth):
/** 
 * Saves all extended Field values for a Domain in the Database.
 * @param c Connection to Database
 * @param d Domain where loaded extended Field Values will be set
 * @throws SQLException If database errors occur.
 */
private void saveExtendedFieldValues(Connection c,Domain d) throws SQLException {
  List<ExtendedFieldValue> list=d.getExtendedFieldValues();
  for (int i=0; i < list.size(); i++) {
    ExtendedFieldValue efv=list.get(i);
    efv.setInstanceID(d.getID());
    ExtendedFieldValueDBDAO dao=(ExtendedFieldValueDBDAO)ExtendedFieldValueDAO.getInstance();
    if (efv.getExtendedFieldValueID() != null) {
      dao.update(c,efv,false);
    }
 else {
      dao.create(c,efv,false);
    }
  }
}
Program: 89637
Project: 89637
Buggy source:
/** 
 * Delete all entries from the config_seedlists table that refer to the given configuration and insert the current ones.
 * @param d A domain to operate on
 * @param dc Configuration to update.
 * @throws SQLException If any database problems occur during the update process.
 */
private void updateConfigSeedlistsEntries(Connection c,Domain d,DomainConfiguration dc) throws SQLException {
  deleteConfigFromTable(c,dc.getID(),"String_Node_Str");
  createConfigSeedlistsEntries(c,d,dc);
}

Fixed version (ground truth):
/** 
 * Delete all entries from the config_seedlists table that refer to the given configuration and insert the current ones.
 * @param c An open connection to the harvestDatabase. 
 * @param d A domain to operate on
 * @param dc Configuration to update.
 * @throws SQLException If any database problems occur during the update process.
 */
private void updateConfigSeedlistsEntries(Connection c,Domain d,DomainConfiguration dc) throws SQLException {
  deleteConfigFromTable(c,dc.getID(),"String_Node_Str");
  createConfigSeedlistsEntries(c,d,dc);
}
Program: 89641
Project: 89641
Buggy source:
/** 
 * reads all extended Field values from the database for a domain.
 * @param c Connection to Database
 * @param d Domain where loaded extended Field Values will be set
 * @throws SQLException If database errors occur.
 */
private void readExtendedFieldValues(Connection c,Domain d) throws SQLException {
  ExtendedFieldDBDAO dao=new ExtendedFieldDBDAO();
  List<ExtendedField> list=dao.getAll(ExtendedFieldTypes.DOMAIN);
  for (int i=0; i < list.size(); i++) {
    ExtendedField ef=list.get(i);
    ExtendedFieldValueDBDAO dao2=new ExtendedFieldValueDBDAO();
    ExtendedFieldValue efv=dao2.read(ef.getExtendedFieldID(),d.getID());
    if (efv == null) {
      efv=new ExtendedFieldValue();
      efv.setExtendedFieldID(ef.getExtendedFieldID());
      efv.setInstanceID(d.getID());
      efv.setContent(ef.getDefaultValue());
    }
    d.addExtendedFieldValue(efv);
  }
}

Fixed version (ground truth):
/** 
 * Reads all extended Field values from the database for a domain.
 * @param d Domain where loaded extended Field Values will be set
 * @throws SQLException If database errors occur.
 */
private void readExtendedFieldValues(Domain d) throws SQLException {
  ExtendedFieldDAO dao=ExtendedFieldDAO.getInstance();
  List<ExtendedField> list=dao.getAll(ExtendedFieldTypes.DOMAIN);
  for (int i=0; i < list.size(); i++) {
    ExtendedField ef=list.get(i);
    ExtendedFieldValueDAO dao2=ExtendedFieldValueDAO.getInstance();
    ExtendedFieldValue efv=dao2.read(ef.getExtendedFieldID(),d.getID());
    if (efv == null) {
      efv=new ExtendedFieldValue();
      efv.setExtendedFieldID(ef.getExtendedFieldID());
      efv.setInstanceID(d.getID());
      efv.setContent(ef.getDefaultValue());
    }
    d.addExtendedFieldValue(efv);
  }
}
Program: 89642
Project: 89642
Buggy source:
/** 
 * Adds Defaultvalues for all extended fields of this entity.
 * @param d the domain to which to add the values
 */
private void addExtendedFieldValues(Domain d){
  ExtendedFieldDAO extendedFieldDAO=ExtendedFieldDBDAO.getInstance();
  List<ExtendedField> list=extendedFieldDAO.getAll(ExtendedFieldTypes.DOMAIN);
  Iterator<ExtendedField> it=list.iterator();
  while (it.hasNext()) {
    ExtendedField ef=it.next();
    ExtendedFieldValue efv=new ExtendedFieldValue();
    efv.setContent(ef.getDefaultValue());
    efv.setExtendedFieldID(ef.getExtendedFieldID());
    d.getExtendedFieldValues().add(efv);
  }
}

Fixed version (ground truth):
/** 
 * Adds Defaultvalues for all extended fields of this entity.
 * @param d the domain to which to add the values
 */
private void addExtendedFieldValues(Domain d){
  ExtendedFieldDAO extendedFieldDAO=ExtendedFieldDAO.getInstance();
  List<ExtendedField> list=extendedFieldDAO.getAll(ExtendedFieldTypes.DOMAIN);
  Iterator<ExtendedField> it=list.iterator();
  while (it.hasNext()) {
    ExtendedField ef=it.next();
    ExtendedFieldValue efv=new ExtendedFieldValue();
    efv.setContent(ef.getDefaultValue());
    efv.setExtendedFieldID(ef.getExtendedFieldID());
    d.getExtendedFieldValues().add(efv);
  }
}
Program: 89644
Project: 89644
Buggy source:
/** 
 * Get list of harvests previous to this one.
 * @param thisHarvest The id of this harvestdefinition
 * @return a list of IDs belonging to harvests previous to this one.
 */
private List<Long> getPreviousFullHarvests(Long thisHarvest){
  List<Long> results=new ArrayList<Long>();
  Connection c=HarvestDBConnection.get();
  for (Long originatingHarvest=thisHarvest; originatingHarvest != null; originatingHarvest=DBUtils.selectFirstLongValueIfAny(c,"String_Node_Str" + "String_Node_Str",originatingHarvest)) {
    if (!originatingHarvest.equals(thisHarvest)) {
      results.add(originatingHarvest);
    }
  }
  Long firstHarvest=thisHarvest;
  if (!results.isEmpty()) {
    firstHarvest=results.get(results.size() - 1);
  }
  Long olderHarvest=DBUtils.selectFirstLongValueIfAny(c,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ HarvestStatusQuery.SORT_ORDER.DESC.name(),firstHarvest);
  for (Long originatingHarvest=olderHarvest; originatingHarvest != null; originatingHarvest=DBUtils.selectFirstLongValueIfAny(c,"String_Node_Str" + "String_Node_Str",originatingHarvest)) {
    results.add(originatingHarvest);
  }
  return results;
}

Fixed version (ground truth):
/** 
 * Get list of harvests previous to this one.
 * @param thisHarvest The id of this harvestdefinition
 * @return a list of IDs belonging to harvests previous to this one.
 */
private List<Long> getPreviousFullHarvests(Long thisHarvest){
  List<Long> results=new ArrayList<Long>();
  Connection c=HarvestDBConnection.get();
  for (Long originatingHarvest=thisHarvest; originatingHarvest != null; originatingHarvest=DBUtils.selectFirstLongValueIfAny(c,"String_Node_Str" + "String_Node_Str",originatingHarvest)) {
    if (!originatingHarvest.equals(thisHarvest)) {
      results.add(originatingHarvest);
    }
  }
  Long firstHarvest=thisHarvest;
  if (!results.isEmpty()) {
    firstHarvest=results.get(results.size() - 1);
  }
  Long olderHarvest=DBUtils.selectFirstLongValueIfAny(c,"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"+ HarvestStatusQuery.SORT_ORDER.DESC.name(),firstHarvest);
  for (Long originatingHarvest=olderHarvest; originatingHarvest != null; originatingHarvest=DBUtils.selectFirstLongValueIfAny(c,"String_Node_Str" + "String_Node_Str",originatingHarvest)) {
    results.add(originatingHarvest);
  }
  return results;
}
Program: 89645
Project: 89645
Buggy source:
private synchronized void setJmxUsername(String jmxUsername){
  this.jmxUsername=jmxUsername;
}

Fixed version (ground truth):
/** 
 * Set the JMX-username with a new value. Null or empty username is not  allowed.
 * @param newJmxUsername New value for the JMX-username
 */
private synchronized void setJmxUsername(String newJmxUsername){
  ArgumentNotValid.checkNotNullOrEmpty(newJmxUsername,"String_Node_Str");
  this.jmxUsername=newJmxUsername;
}
Program: 89646
Project: 89646
Buggy source:
private synchronized void setJmxPassword(String jmxPassword){
  this.jmxPassword=jmxPassword;
}

Fixed version (ground truth):
/** 
 * Set the JMX-password with a new value. Null or empty password is not  allowed.
 * @param newJmxPassword New value for the JMX-password 
 */
private synchronized void setJmxPassword(String newJmxPassword){
  ArgumentNotValid.checkNotNullOrEmpty(newJmxPassword,"String_Node_Str");
  this.jmxPassword=newJmxPassword;
}
Program: 89647
Project: 89647
Buggy source:
private String getJmxUsername(){
  return jmxUsername;
}

Fixed version (ground truth):
/** 
 * @return the JMX-Username
 */
private String getJmxUsername(){
  return jmxUsername;
}
Program: 89648
Project: 89648
Buggy source:
/** 
 * Returns the domain from a given query. Used for constructing an error-mbean-name on connection trouble.
 * @param mBeanQuery The query to return the domain from.
 * @return the domain from a given query.
 */
private String queryToDomain(String mBeanQuery){
  return mBeanQuery.replaceAll("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Returns the domain from a given query. Used for constructing an error-mbean-name on connection trouble.
 * @param aMBeanQuery The query to return the domain from.
 * @return the domain from a given query.
 */
private String queryToDomain(String aMBeanQuery){
  return aMBeanQuery.replaceAll("String_Node_Str","String_Node_Str");
}
Program: 89649
Project: 89649
Buggy source:
private String getJmxPassword(){
  return jmxUsername;
}

Fixed version (ground truth):
/** 
 * @return the JMX-password
 */
private String getJmxPassword(){
  return jmxPassword;
}
Program: 89650
Project: 89650
Buggy source:
/** 
 * Get the log record on a given index from the top as a string. This will be formatted by some formatter, depending on implementation.
 * @return A String representation of the LogRecord, or null for none.
 */
public String getRecordString();

Fixed version (ground truth):
/** 
 * Get the log record on a given index from the top as a string. This will be formatted by some formatter, depending on implementation.
 * @return A String representation of the LogRecord, or null for none.
 */
String getRecordString();
Program: 89651
Project: 89651
Buggy source:
/** 
 * Update the given PartialHarvest (i.e. Selective Harvest) with a new  time for the next harvestrun.
 * @see HarvestDefinitionDAO#updateNextdate(PartialHarvest,Date)
 */
@Override public void updateNextdate(PartialHarvest ph,Date nextdate){
  ArgumentNotValid.checkNotNull(ph,"String_Node_Str");
  ArgumentNotValid.checkNotNull(nextdate,"String_Node_Str");
  if (ph.getOid() == null) {
    return;
  }
  Connection connection=HarvestDBConnection.get();
  PreparedStatement s=null;
  try {
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    DBUtils.setDateMaybeNull(s,1,ph.getNextDate());
    s.setLong(2,ph.getOid());
    s.executeUpdate();
  }
 catch (  SQLException e) {
    log.warn("String_Node_Str" + "String_Node_Str" + ExceptionUtils.getSQLExceptionCause(e),e);
  }
 finally {
    DBUtils.rollbackIfNeeded(connection,"String_Node_Str",ph);
    HarvestDBConnection.release(connection);
  }
}

Fixed version (ground truth):
/** 
 * Update the given PartialHarvest (i.e. Selective Harvest) with a new  time for the next harvestrun.
 * @see HarvestDefinitionDAO#updateNextdate(PartialHarvest,Date)
 */
@Override public void updateNextdate(PartialHarvest ph,Date nextdate){
  ArgumentNotValid.checkNotNull(ph,"String_Node_Str");
  ArgumentNotValid.checkNotNull(nextdate,"String_Node_Str");
  if (ph.getOid() == null) {
    return;
  }
  Connection connection=HarvestDBConnection.get();
  PreparedStatement s=null;
  try {
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    DBUtils.setDateMaybeNull(s,1,nextdate);
    s.setLong(2,ph.getOid());
    s.executeUpdate();
  }
 catch (  SQLException e) {
    log.warn("String_Node_Str" + "String_Node_Str" + ExceptionUtils.getSQLExceptionCause(e),e);
  }
 finally {
    DBUtils.rollbackIfNeeded(connection,"String_Node_Str",ph);
    HarvestDBConnection.release(connection);
  }
}
Program: 89652
Project: 89652
Buggy source:
/** 
 * Test the   {@link HarvestDefinitionDAO#updateNextdate(PartialHarvest,Date)} method.
 */
public void testUpdateNextDate(){
  HarvestDefinitionDAO hddao=HarvestDefinitionDAO.getInstance();
  long partialharvestId=42L;
  HarvestDefinition hd=hddao.read(partialharvestId);
  if (!(hd instanceof PartialHarvest)) {
    fail("String_Node_Str" + partialharvestId + "String_Node_Str");
  }
  PartialHarvest ph=(PartialHarvest)hd;
  Date now=new Date();
  ph.setNextDate(now);
  hddao.updateNextdate(ph,now);
  PartialHarvest ph1=(PartialHarvest)hddao.read(partialharvestId);
  assertTrue("String_Node_Str",ph1.getNextDate().equals(now));
}

Fixed version (ground truth):
/** 
 * Test the   {@link HarvestDefinitionDAO#updateNextdate(PartialHarvest,Date)} method.
 */
public void testUpdateNextDate(){
  HarvestDefinitionDAO hddao=HarvestDefinitionDAO.getInstance();
  long partialharvestId=42L;
  HarvestDefinition hd=hddao.read(partialharvestId);
  if (!(hd instanceof PartialHarvest)) {
    fail("String_Node_Str" + partialharvestId + "String_Node_Str");
  }
  PartialHarvest ph=(PartialHarvest)hd;
  Date now=new Date();
  hddao.updateNextdate(ph,now);
  PartialHarvest ph1=(PartialHarvest)hddao.read(partialharvestId);
  assertTrue("String_Node_Str",ph1.getNextDate().equals(now));
}
Program: 89653
Project: 89653
Buggy source:
/** 
 * Adds a directory with jsp files on the given basepath of the web server. Note: This must be done BEFORE starting the server. The webbase is deduced from the name of the webapp.
 * @param webapp  a directory with jsp files or a war file.
 * @throws IOFailure        if directory is not found.
 * @throws ArgumentNotValid if either argument is null or empty or ifwebbase doesn't start with '/'.
 * @throws PermissionDenied if the server is already running.
 */
private void addWebApplication(String webapp) throws IOFailure, ArgumentNotValid, PermissionDenied {
  if (!new File(webapp).exists()) {
    throw new IOFailure("String_Node_Str" + webapp + "String_Node_Str");
  }
  String webappFilename=new File(webapp).getName();
  String webbase="String_Node_Str" + webappFilename;
  if (webappFilename.toLowerCase().endsWith("String_Node_Str")) {
    webbase="String_Node_Str" + webappFilename.substring(0,webappFilename.length() - 4);
  }
  for (  SiteSection section : SiteSection.getSections()) {
    if (webbase.equals("String_Node_Str" + section.getDirname())) {
      section.initialize();
      break;
    }
  }
  WebAppContext webApplication=new WebAppContext(webapp,webbase);
  webApplication.setMaxFormContentSize(-1);
  webApplication.setTempDirectory(new File(FileUtils.getTempDir(),webbase));
  server.addHandler(webApplication);
  log.info("String_Node_Str" + webapp + "String_Node_Str"+ webbase+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Adds a directory with jsp files on the given basepath of the web server. Note: This must be done BEFORE starting the server. The webbase is deduced from the name of the webapp.
 * @param webapp  a directory with jsp files or a war file.
 * @throws IOFailure        if directory is not found.
 * @throws ArgumentNotValid if either argument is null or empty or ifwebbase doesn't start with '/'.
 * @throws PermissionDenied if the server is already running.
 */
private void addWebApplication(String webapp) throws IOFailure, ArgumentNotValid, PermissionDenied {
  if (!new File(webapp).exists()) {
    throw new IOFailure("String_Node_Str" + webapp + "String_Node_Str");
  }
  String webappFilename=new File(webapp).getName();
  String webbase="String_Node_Str" + webappFilename;
  if (webappFilename.toLowerCase().endsWith("String_Node_Str")) {
    webbase="String_Node_Str" + webappFilename.substring(0,webappFilename.length() - 4);
  }
  for (  SiteSection section : SiteSection.getSections()) {
    if (webbase.equals("String_Node_Str" + section.getDirname())) {
      section.initialize();
      break;
    }
  }
  WebAppContext webApplication=new WebAppContext(webapp,webbase);
  webApplication.setMaxFormContentSize(-1);
  File tmpdir=new File(FileUtils.getTempDir(),webbase);
  if (tmpdir.exists()) {
    FileUtils.removeRecursively(tmpdir);
    log.info("String_Node_Str" + tmpdir.getAbsolutePath() + "String_Node_Str");
  }
  webApplication.setTempDirectory(tmpdir);
  server.addHandler(webApplication);
  log.info("String_Node_Str" + webapp + "String_Node_Str"+ webbase+ "String_Node_Str");
}
Program: 89654
Project: 89654
Buggy source:
@Override public void setUp() throws Exception {
  super.setUp();
  try {
    LogManager.getLogManager().readConfiguration(new FileInputStream(TESTLOGPROP));
  }
 catch (  IOException e) {
    fail("String_Node_Str");
  }
  originalSettings.setUp();
  System.setProperty(WaybackSettings.WAYBACK_AGGREGATOR_TEMP_DIR,tempDirName);
  System.setProperty(WaybackSettings.WAYBACK_AGGREGATOR_OUTPUT_DIR,outputDirName);
  System.setProperty(WaybackSettings.WAYBACK_AGGREGATOR_AGGREGATION_INTERVAL,"String_Node_Str");
  System.setProperty(WaybackSettings.WAYBACK_AGGREGATOR_MAX_INTERMEDIATE_INDEX_FILE_SIZE,"String_Node_Str");
  System.setProperty(WaybackSettings.WAYBACK_AGGREGATOR_MAX_MAIN_INDEX_FILE_SIZE,"String_Node_Str");
  FileUtils.removeRecursively(new File(testWorkingDirectory));
  new File(inputDirName).mkdirs();
  new File(outputDirName).mkdirs();
}

Fixed version (ground truth):
@Override public void setUp() throws Exception {
  super.setUp();
  try {
    LogManager.getLogManager().readConfiguration(new FileInputStream(TESTLOGPROP));
  }
 catch (  IOException e) {
    fail("String_Node_Str");
  }
  originalSettings.setUp();
  System.setProperty(WaybackSettings.WAYBACK_BATCH_OUTPUTDIR,inputDirName);
  System.setProperty(WaybackSettings.WAYBACK_AGGREGATOR_TEMP_DIR,tempDirName);
  System.setProperty(WaybackSettings.WAYBACK_AGGREGATOR_OUTPUT_DIR,outputDirName);
  System.setProperty(WaybackSettings.WAYBACK_AGGREGATOR_AGGREGATION_INTERVAL,"String_Node_Str");
  System.setProperty(WaybackSettings.WAYBACK_AGGREGATOR_MAX_INTERMEDIATE_INDEX_FILE_SIZE,"String_Node_Str");
  System.setProperty(WaybackSettings.WAYBACK_AGGREGATOR_MAX_MAIN_INDEX_FILE_SIZE,"String_Node_Str");
  FileUtils.removeRecursively(new File(testWorkingDirectory));
  new File(inputDirName).mkdirs();
  new File(outputDirName).mkdirs();
}
Program: 89656
Project: 89656
Buggy source:
/** 
 * Update the given PartialHarvest (i.e. Selective Harvest) with a new  time for the next harvestrun.
 * @See {@link HarvestDefinitionDAO#updateNextdate(PartialHarvest,Date)}
 */
@Override public void updateNextdate(PartialHarvest ph,Date nextdate){
  ArgumentNotValid.checkNotNull(ph,"String_Node_Str");
  ArgumentNotValid.checkNotNull(nextdate,"String_Node_Str");
  if (ph.getOid() == null) {
    return;
  }
  Connection connection=HarvestDBConnection.get();
  PreparedStatement s=null;
  try {
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    DBUtils.setDateMaybeNull(s,1,ph.getNextDate());
    s.setLong(2,ph.getOid());
    s.executeUpdate();
  }
 catch (  SQLException e) {
    log.warn("String_Node_Str" + "String_Node_Str" + ExceptionUtils.getSQLExceptionCause(e),e);
  }
 finally {
    DBUtils.rollbackIfNeeded(connection,"String_Node_Str",ph);
    HarvestDBConnection.release(connection);
  }
}

Fixed version (ground truth):
/** 
 * Update the given PartialHarvest (i.e. Selective Harvest) with a new  time for the next harvestrun.
 * @see HarvestDefinitionDAO#updateNextdate(PartialHarvest,Date)
 */
@Override public void updateNextdate(PartialHarvest ph,Date nextdate){
  ArgumentNotValid.checkNotNull(ph,"String_Node_Str");
  ArgumentNotValid.checkNotNull(nextdate,"String_Node_Str");
  if (ph.getOid() == null) {
    return;
  }
  Connection connection=HarvestDBConnection.get();
  PreparedStatement s=null;
  try {
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    DBUtils.setDateMaybeNull(s,1,ph.getNextDate());
    s.setLong(2,ph.getOid());
    s.executeUpdate();
  }
 catch (  SQLException e) {
    log.warn("String_Node_Str" + "String_Node_Str" + ExceptionUtils.getSQLExceptionCause(e),e);
  }
 finally {
    DBUtils.rollbackIfNeeded(connection,"String_Node_Str",ph);
    HarvestDBConnection.release(connection);
  }
}
Program: 89658
Project: 89658
Buggy source:
/** 
 * updates a extendedFieldValue by extendedField Is
 * @param aExtendedFieldId id of the extendedfield
 * @param aContent id content to set
 */
public void updateExtendedFieldValue(Long aExtendedFieldId,String aContent){
  for (int i=0; i < extendedFieldValues.size(); i++) {
    if (extendedFieldValues.get(i).getExtendedFieldID().equals(aExtendedFieldId)) {
      extendedFieldValues.get(i).setContent(aContent);
      return;
    }
  }
}

Fixed version (ground truth):
/** 
 * updates a extendedFieldValue by extendedField Id.
 * @param aExtendedFieldId id of the extendedfield
 * @param aContent id content to set
 */
public void updateExtendedFieldValue(Long aExtendedFieldId,String aContent){
  for (int i=0; i < extendedFieldValues.size(); i++) {
    if (extendedFieldValues.get(i).getExtendedFieldID().equals(aExtendedFieldId)) {
      extendedFieldValues.get(i).setContent(aContent);
      return;
    }
  }
}
Program: 89659
Project: 89659
Buggy source:
/** 
 * Gets all configurations belonging to this domain. The returned list is sorted by name according to language given in the parameter
 * @param loc contains the language sorting must adhere to
 * @return all configurations belonging to this domain sorted according tolanguage
 */
public List<DomainConfiguration> getAllConfigurationsAsSortedList(Locale loc){
  ArgumentNotValid.checkNotNull(loc,"String_Node_Str");
  List<DomainConfiguration> resultSet=new ArrayList<DomainConfiguration>(domainConfigurations.values());
  NamedUtils.sortNamedObjectList(loc,resultSet);
  return resultSet;
}

Fixed version (ground truth):
/** 
 * Gets all configurations belonging to this domain. The returned list is sorted by name according to language given in the parameter.
 * @param loc contains the language sorting must adhere to
 * @return all configurations belonging to this domain sorted according tolanguage
 */
public List<DomainConfiguration> getAllConfigurationsAsSortedList(Locale loc){
  ArgumentNotValid.checkNotNull(loc,"String_Node_Str");
  List<DomainConfiguration> resultSet=new ArrayList<DomainConfiguration>(domainConfigurations.values());
  NamedUtils.sortNamedObjectList(loc,resultSet);
  return resultSet;
}
Program: 89660
Project: 89660
Buggy source:
/** 
 * adds a Value to the ExtendedFieldValue List
 * @param aValue Valueobject of the extended Field
 */
public void addExtendedFieldValue(ExtendedFieldValue aValue){
  extendedFieldValues.add(aValue);
}

Fixed version (ground truth):
/** 
 * adds a Value to the ExtendedFieldValue List.
 * @param aValue Valueobject of the extended Field
 */
public void addExtendedFieldValue(ExtendedFieldValue aValue){
  extendedFieldValues.add(aValue);
}
Program: 89661
Project: 89661
Buggy source:
/** 
 * gets a extendedFieldValue by extendedField Is
 * @param aExtendedFieldId id of the extendedfield
 * @return ExtendedFieldValue Object
 */
public ExtendedFieldValue getExtendedFieldValue(Long aExtendedFieldId){
  for (int i=0; i < extendedFieldValues.size(); i++) {
    if (extendedFieldValues.get(i).getExtendedFieldID().equals(aExtendedFieldId)) {
      return extendedFieldValues.get(i);
    }
  }
  return new ExtendedFieldValue();
}

Fixed version (ground truth):
/** 
 * gets a extendedFieldValue by extendedField ID.
 * @param aExtendedFieldId id of the extendedfield
 * @return ExtendedFieldValue Object
 */
public ExtendedFieldValue getExtendedFieldValue(Long aExtendedFieldId){
  for (int i=0; i < extendedFieldValues.size(); i++) {
    if (extendedFieldValues.get(i).getExtendedFieldID().equals(aExtendedFieldId)) {
      return extendedFieldValues.get(i);
    }
  }
  return new ExtendedFieldValue();
}
Program: 89662
Project: 89662
Buggy source:
/** 
 * sets a List of extendedFieldValues
 * @param aValue List of extended Field objects
 */
public void setExtendedFieldValues(List<ExtendedFieldValue> aList){
  extendedFieldValues=aList;
}

Fixed version (ground truth):
/** 
 * sets a List of extendedFieldValues.
 * @param aList List of extended Field objects
 */
public void setExtendedFieldValues(List<ExtendedFieldValue> aList){
  extendedFieldValues=aList;
}
Program: 89663
Project: 89663
Buggy source:
/** 
 * Run a batch job to index this file, storing the result locally. If this method runs successfully, the isIndexed flag will be set to true and the originalIndexFileName field will be set to the (arbitrary) name of the file containing the results. The values are persisted to the datastore.
 * @throws IllegalState If the indexing has already been done.
 */
public void index() throws IllegalState {
  log.info("String_Node_Str" + toString());
  if (isIndexed) {
    throw new IllegalState("String_Node_Str" + filename + "String_Node_Str");
  }
  FileBatchJob theJob=null;
  if (filename.contains("String_Node_Str")) {
    theJob=new ExtractDeduplicateCDXBatchJob();
  }
 else {
    theJob=new ExtractWaybackCDXBatchJob();
  }
  theJob.processOnlyFileNamed(filename);
  PreservationArcRepositoryClient client=ArcRepositoryClientFactory.getPreservationInstance();
  BatchStatus batchStatus=client.batch(theJob,Settings.get(WaybackSettings.WAYBACK_REPLICA));
  if (!batchStatus.getFilesFailed().isEmpty() || batchStatus.getNoOfFilesProcessed() != 1 || !batchStatus.getExceptions().isEmpty()) {
    logBatchError(batchStatus);
  }
 else {
    collectResults(batchStatus);
  }
}

Fixed version (ground truth):
/** 
 * Run a batch job to index this file, storing the result locally. If this method runs successfully, the isIndexed flag will be set to true and the originalIndexFileName field will be set to the (arbitrary) name of the file containing the results. The values are persisted to the datastore.
 * @throws IllegalState If the indexing has already been done.
 */
public void index() throws IllegalState {
  log.info("String_Node_Str" + this.getFilename());
  if (isIndexed) {
    throw new IllegalState("String_Node_Str" + filename + "String_Node_Str");
  }
  FileBatchJob theJob=null;
  if (filename.contains("String_Node_Str")) {
    theJob=new ExtractDeduplicateCDXBatchJob();
  }
 else {
    theJob=new ExtractWaybackCDXBatchJob();
  }
  theJob.processOnlyFileNamed(filename);
  PreservationArcRepositoryClient client=ArcRepositoryClientFactory.getPreservationInstance();
  String replicaId=Settings.get(WaybackSettings.WAYBACK_REPLICA);
  log.info("String_Node_Str" + theJob.getClass().getName() + "String_Node_Str"+ getFilename()+ "String_Node_Str"+ replicaId);
  BatchStatus batchStatus=client.batch(theJob,replicaId);
  log.info("String_Node_Str" + this.getFilename() + "String_Node_Str");
  if (!batchStatus.getFilesFailed().isEmpty() || batchStatus.getNoOfFilesProcessed() != 1 || !batchStatus.getExceptions().isEmpty()) {
    logBatchError(batchStatus);
  }
 else {
    collectResults(batchStatus);
  }
}
Program: 89664
Project: 89664
Buggy source:
/** 
 * Collects the batch results from the BatchStatus, first to a file in temporary directory, after which they are renamed to the directory WAYBACK_BATCH_OUTPUTDIR. The status of this object is then updated to reflect that the object has been indexed.
 * @param status the status of a batch job.
 */
private void collectResults(BatchStatus status){
  String outputFilename=UUID.randomUUID().toString();
  String tempBatchOutputDir=Settings.get(WaybackSettings.WAYBACK_INDEX_TEMPDIR);
  final File outDir=new File(tempBatchOutputDir);
  FileUtils.createDir(outDir);
  File batchOutputFile=new File(outDir,outputFilename);
  status.copyResults(batchOutputFile);
  String finalBatchOutputDir=Settings.get(WaybackSettings.WAYBACK_BATCH_OUTPUTDIR);
  final File finalDirectory=new File(finalBatchOutputDir);
  FileUtils.createDir(finalDirectory);
  File finalFile=new File(finalDirectory,outputFilename);
  batchOutputFile.renameTo(finalFile);
  originalIndexFileName=outputFilename;
  isIndexed=true;
  log.info("String_Node_Str" + this.filename + "String_Node_Str"+ originalIndexFileName+ "String_Node_Str");
  (new ArchiveFileDAO()).update(this);
}

Fixed version (ground truth):
/** 
 * Collects the batch results from the BatchStatus, first to a file in temporary directory, after which they are renamed to the directory WAYBACK_BATCH_OUTPUTDIR. The status of this object is then updated to reflect that the object has been indexed.
 * @param status the status of a batch job.
 */
private void collectResults(BatchStatus status){
  String outputFilename=UUID.randomUUID().toString();
  String tempBatchOutputDir=Settings.get(WaybackSettings.WAYBACK_INDEX_TEMPDIR);
  final File outDir=new File(tempBatchOutputDir);
  FileUtils.createDir(outDir);
  File batchOutputFile=new File(outDir,outputFilename);
  log.info("String_Node_Str" + this.getFilename() + "String_Node_Str"+ batchOutputFile.getAbsolutePath()+ "String_Node_Str");
  status.copyResults(batchOutputFile);
  log.info("String_Node_Str" + this.getFilename() + "String_Node_Str"+ batchOutputFile.getAbsolutePath()+ "String_Node_Str");
  String finalBatchOutputDir=Settings.get(WaybackSettings.WAYBACK_BATCH_OUTPUTDIR);
  final File finalDirectory=new File(finalBatchOutputDir);
  FileUtils.createDir(finalDirectory);
  File finalFile=new File(finalDirectory,outputFilename);
  batchOutputFile.renameTo(finalFile);
  originalIndexFileName=outputFilename;
  isIndexed=true;
  log.info("String_Node_Str" + this.filename + "String_Node_Str"+ finalFile.getAbsolutePath()+ "String_Node_Str");
  (new ArchiveFileDAO()).update(this);
}