nus-yam/ex-repair huggingface dataset:
Program: 89905
Project: 89905
Buggy source:
/** 
 * Retrieve the list of jobs for deduplicate reduction. Runs through all metadata entries, finding duplicate reduction entries, and parsing all jobIDs in them, warning only on errors.
 * @param metadataEntries list of metadataEntries
 * @return the list of jobs for deduplicate reduction
 */
private List<Long> parseJobIDsForDuplicateReduction(List<MetadataEntry> metadataEntries){
  List<Long> result=new ArrayList<Long>();
  for (  MetadataEntry me : metadataEntries) {
    if (me.isDuplicateReductionMetadataEntry()) {
      String s=new String(me.getData());
      String[] longs=s.split("String_Node_Str");
      for (      String stringLong : longs) {
        try {
          result.add(Long.getLong(stringLong));
        }
 catch (        NumberFormatException e) {
          log.warn("String_Node_Str" + stringLong + "String_Node_Str"+ "String_Node_Str"+ s+ "String_Node_Str",e);
        }
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Retrieve the list of jobs for deduplicate reduction. Runs through all metadata entries, finding duplicate reduction entries, and parsing all jobIDs in them, warning only on errors.
 * @param metadataEntries list of metadataEntries
 * @return the list of jobs for deduplicate reduction
 */
private List<Long> parseJobIDsForDuplicateReduction(List<MetadataEntry> metadataEntries){
  List<Long> result=new ArrayList<Long>();
  for (  MetadataEntry me : metadataEntries) {
    if (me.isDuplicateReductionMetadataEntry()) {
      String s=new String(me.getData());
      String[] longs=s.split("String_Node_Str");
      for (      String stringLong : longs) {
        try {
          result.add(Long.parseLong(stringLong));
        }
 catch (        NumberFormatException e) {
          log.warn("String_Node_Str" + stringLong + "String_Node_Str"+ "String_Node_Str"+ s+ "String_Node_Str",e);
        }
      }
    }
  }
  return result;
}
Program: 89907
Project: 89907
Buggy source:
/** 
 * Forgiving index generating method, that returns a file with an index, of the greatest possible subset of a given id, and the subset. If the type I for instance is a Set, you may get an index of only a subset. If I is a File, null may be seen as a subset.
 * @see #cache for more information.
 * @param id The requested index.
 * @return An index over the greatest possible subset, and the subset.
 */
public Index<I> getIndex(I id){
  I response=id;
  I lastResponse=null;
  while (response != null && !response.equals(lastResponse)) {
    if (lastResponse != null) {
      log.info("String_Node_Str" + this.getCacheDir().getName() + "String_Node_Str"+ lastResponse+ "String_Node_Str"+ response+ "String_Node_Str");
    }
    lastResponse=response;
    response=cache(lastResponse);
  }
  File cacheFile=getCacheFile(response);
  log.info("String_Node_Str" + cacheFile + "String_Node_Str"+ response+ "String_Node_Str"+ id+ "String_Node_Str");
  return new Index<I>(cacheFile,response);
}

Fixed version (ground truth):
/** 
 * Forgiving index generating method, that returns a file with an index, of the greatest possible subset of a given id, and the subset. If the type I for instance is a Set, you may get an index of only a subset. If I is a File, null may be seen as a subset.
 * @param id The requested index.
 * @return An index over the greatest possible subset, and the subset.
 * @see #cache for more information.
 */
public Index<I> getIndex(I id){
  I response=id;
  I lastResponse=null;
  while (response != null && !response.equals(lastResponse)) {
    if (lastResponse != null) {
      log.info("String_Node_Str" + this.getCacheDir().getName() + "String_Node_Str"+ lastResponse+ "String_Node_Str"+ response+ "String_Node_Str");
    }
    lastResponse=response;
    response=cache(lastResponse);
  }
  File cacheFile=getCacheFile(response);
  log.info("String_Node_Str" + cacheFile + "String_Node_Str"+ response+ "String_Node_Str"+ id+ "String_Node_Str");
  return new Index<I>(cacheFile,response);
}
Program: 89908
Project: 89908
Buggy source:
/** 
 * Fill in actual data in the file in the cache.  This is the workhorse method that is allowed to modify the cache.  When this method is called, the cache can assume that getCacheFile(id) does not exist.
 * @param id Some identifier for the item to be cached.
 * @return An id of content actually available.  In most cases, this willbe the same as id, but for complex I it could be a subset (or null if the type argument I is a simple type).  If the return value is not the same as id, the file will not contain cached data, and may not even exist.
 */
protected abstract I cacheData(I id);

Fixed version (ground truth):
/** 
 * Fill in actual data in the file in the cache.  This is the workhorse method that is allowed to modify the cache.  When this method is called, the cache can assume that getCacheFile(id) does not exist.
 * @param id Some identifier for the item to be cached.
 * @return An id of content actually available.  In most cases, this will bethe same as id, but for complex I it could be a subset (or null if the type argument I is a simple type).  If the return value is not the same as id, the file will not contain cached data, and may not even exist.
 */
protected abstract I cacheData(I id);
Program: 89909
Project: 89909
Buggy source:
/** 
 * Utility method to get a number of cache entries at a time. Implementations of FileBasedCache may override this to perform the caching more efficiently, if caching overhead per file is large.
 * @param IDs List of IDs that uniquely identify a set of items withinthe cache.
 * @return A map from ID to the files containing cached data for thoseIDs.  If caching failed, even partially, for an ID, the entry for the ID doesn't exist.
 */
public Map<I,File> get(Set<I> IDs){
  ArgumentNotValid.checkNotNull(IDs,"String_Node_Str");
  Map<I,File> result=new HashMap<I,File>(IDs.size());
  for (  I ID : IDs) {
    if (ID.equals(cache(ID))) {
      result.put(ID,getCacheFile(ID));
    }
 else {
      result.put(ID,null);
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Utility method to get a number of cache entries at a time. Implementations of FileBasedCache may override this to perform the caching more efficiently, if caching overhead per file is large.
 * @param IDs List of IDs that uniquely identify a set of items within thecache.
 * @return A map from ID to the files containing cached data for those IDs.If caching failed, even partially, for an ID, the entry for the ID doesn't exist.
 */
public Map<I,File> get(Set<I> IDs){
  ArgumentNotValid.checkNotNull(IDs,"String_Node_Str");
  Map<I,File> result=new HashMap<I,File>(IDs.size());
  for (  I ID : IDs) {
    if (ID.equals(cache(ID))) {
      result.put(ID,getCacheFile(ID));
    }
 else {
      result.put(ID,null);
    }
  }
  return result;
}
Program: 89910
Project: 89910
Buggy source:
public void testGenerateCDX() throws FileNotFoundException {
  File file1=new File(TestInfo.WORKING_DIR,"String_Node_Str");
  File file2=new File(TestInfo.WORKING_DIR,"String_Node_Str");
  String[] files=new String[]{file1.getAbsolutePath(),file2.getAbsolutePath()};
  DeduplicateToCDXApplication app=new DeduplicateToCDXApplication();
  app.generateCDX(files);
  String output=((ByteArrayOutputStream)new_std_out).toString();
  String error=((ByteArrayOutputStream)new_std_err).toString();
  assertTrue("String_Node_Str",error.equals("String_Node_Str"));
  assertTrue("String_Node_Str" + output + "String_Node_Str",output.split("String_Node_Str").length > 20);
}

Fixed version (ground truth):
public void testGenerateCDX() throws IOException {
  File file1=new File(TestInfo.WORKING_DIR,"String_Node_Str");
  File file2=new File(TestInfo.WORKING_DIR,"String_Node_Str");
  String[] files=new String[]{file1.getAbsolutePath(),file2.getAbsolutePath()};
  DeduplicateToCDXApplication app=new DeduplicateToCDXApplication();
  app.generateCDX(files);
  String output=((ByteArrayOutputStream)new_std_out).toString();
  String error=((ByteArrayOutputStream)new_std_err).toString();
  assertTrue("String_Node_Str",error.equals("String_Node_Str"));
  assertTrue("String_Node_Str" + output + "String_Node_Str",output.split("String_Node_Str").length > 20);
}
Program: 89911
Project: 89911
Buggy source:
/** 
 * Returns a string representing the instance.
 * @return a string
 */
public String toString(){
  return "String_Node_Str" + replyOfId + "String_Node_Str"+ noOfFilesProcessed+ "String_Node_Str"+ filesFailed.size()+ "String_Node_Str"+ super.toString();
}

Fixed version (ground truth):
/** 
 * Returns a string representing the instance.
 * @return a string
 */
public String toString(){
  return "String_Node_Str" + replyOfId + "String_Node_Str"+ noOfFilesProcessed+ "String_Node_Str"+ (filesFailed == null ? "String_Node_Str" : filesFailed.size())+ "String_Node_Str"+ super.toString();
}
Program: 89912
Project: 89912
Buggy source:
/** 
 * Test message is sent and returned, and set "OK" if no errors occurs.
 */
public void testStore(){
  file=new File(new File(BITARCHIVE_DIR,"String_Node_Str"),STORABLE_FILES.get(0).toString());
  ArcRepository arc=ArcRepository.getInstance();
  StoreMessage msg=new StoreMessage(Channels.getError(),file);
  new ArcRepositoryServer(arc).visit(msg);
  assertTrue("String_Node_Str",msg.isOk());
  arc.close();
}

Fixed version (ground truth):
/** 
 * Test message is sent and returned, and set "OK" if no errors occurs.
 */
public void testStore(){
  file=new File(new File(BITARCHIVE_DIR,"String_Node_Str"),STORABLE_FILES.get(0).toString());
  ArcRepository arc=ArcRepository.getInstance();
  StoreMessage msg=new StoreMessage(Channels.getError(),file);
  JMSConnectionMockupMQ.updateMsgID(msg,"String_Node_Str");
  new ArcRepositoryServer(arc).visit(msg);
  assertTrue("String_Node_Str",msg.isOk());
  arc.close();
}
Program: 89913
Project: 89913
Buggy source:
/** 
 * Test message is sent and returned, and set "Not OK" if an error occurs.
 */
public void testStoreNoSuchFile(){
  file=new File(BITARCHIVE_DIR,"String_Node_Str");
  ArcRepository arc=ArcRepository.getInstance();
  try {
    new StoreMessage(Channels.getError(),file);
    fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  ArgumentNotValid e) {
  }
  Settings.set(CommonSettings.REMOTE_FILE_CLASS,NullRemoteFile.class.getName());
  file=new File(new File(BITARCHIVE_DIR,"String_Node_Str"),STORABLE_FILES.get(0).toString());
  StoreMessage msg=new StoreMessage(Channels.getError(),file);
  dummyServer.reset();
  new ArcRepositoryServer(arc).visit(msg);
  ((JMSConnectionMockupMQ)JMSConnectionMockupMQ.getInstance()).waitForConcurrentTasksToFinish();
  assertFalse("String_Node_Str",msg.isOk());
  assertEquals("String_Node_Str",dummyServer.msgNotOK,1);
  arc.close();
}

Fixed version (ground truth):
/** 
 * Test message is sent and returned, and set "Not OK" if an error occurs.
 */
public void testStoreNoSuchFile(){
  file=new File(BITARCHIVE_DIR,"String_Node_Str");
  ArcRepository arc=ArcRepository.getInstance();
  try {
    new StoreMessage(Channels.getError(),file);
    fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  ArgumentNotValid e) {
  }
  Settings.set(CommonSettings.REMOTE_FILE_CLASS,NullRemoteFile.class.getName());
  file=new File(new File(BITARCHIVE_DIR,"String_Node_Str"),STORABLE_FILES.get(0).toString());
  StoreMessage msg=new StoreMessage(Channels.getError(),file);
  JMSConnectionMockupMQ.updateMsgID(msg,"String_Node_Str");
  dummyServer.reset();
  new ArcRepositoryServer(arc).visit(msg);
  ((JMSConnectionMockupMQ)JMSConnectionMockupMQ.getInstance()).waitForConcurrentTasksToFinish();
  assertFalse("String_Node_Str",msg.isOk());
  assertEquals("String_Node_Str",dummyServer.msgNotOK,1);
  arc.close();
}
Program: 89914
Project: 89914
Buggy source:
public void testStoreTimeouts() throws IOException, InterruptedException {
  Settings.set(JMSArcRepositoryClient.ARCREPOSITORY_STORE_TIMEOUT,"String_Node_Str");
  arc.close();
  arc=(JMSArcRepositoryClient)ArcRepositoryClientFactory.getHarvesterInstance();
  final boolean[] ok=new boolean[]{false};
  new Thread(){
    public void run(){
      try {
        arc.store(ARCFILE);
      }
 catch (      IOFailure e) {
      }
      ok[0]=true;
synchronized (JMSArcRepositoryClientTester.this) {
        JMSArcRepositoryClientTester.this.notify();
      }
    }
  }
.start();
synchronized (this) {
    wait(3000);
  }
  assertTrue("String_Node_Str",ok[0]);
  CollectionAsserts.assertListEquals("String_Node_Str",new ArrayList<RemoteFile>(TestRemoteFile.remainingFiles()));
}

Fixed version (ground truth):
public void testStoreTimeouts() throws IOException, InterruptedException {
  Settings.set(JMSArcRepositoryClient.ARCREPOSITORY_STORE_TIMEOUT,"String_Node_Str");
  arc.close();
  arc=(JMSArcRepositoryClient)ArcRepositoryClientFactory.getHarvesterInstance();
  final boolean[] ok=new boolean[]{false};
  new Thread(){
    public void run(){
      try {
        arc.store(ARCFILE);
      }
 catch (      IOFailure e) {
      }
      ok[0]=true;
synchronized (JMSArcRepositoryClientTester.this) {
        JMSArcRepositoryClientTester.this.notify();
      }
    }
  }
.start();
synchronized (this) {
    wait(3200);
  }
  assertTrue("String_Node_Str",ok[0]);
  CollectionAsserts.assertListEquals("String_Node_Str",new ArrayList<RemoteFile>(TestRemoteFile.remainingFiles()));
}
Program: 89918
Project: 89918
Buggy source:
public void testListenerNotRemovedOnErrors(){
  bas=BitarchiveServer.getInstance();
  ChannelID arcReposQ=Channels.getTheRepos();
  ChannelID anyBa=Channels.getAnyBa();
  JMSConnectionMockupMQ conn=(JMSConnectionMockupMQ)JMSConnectionFactory.getInstance();
  GenericMessageListener listener=new GenericMessageListener();
  conn.setListener(arcReposQ,listener);
  int expectedListeners=1;
  assertEquals("String_Node_Str" + anyBa + "String_Node_Str"+ expectedListeners+ "String_Node_Str",expectedListeners,conn.getListeners(anyBa).size());
  File testFile=TestInfo.UPLOADMESSAGE_TESTFILE_1;
  RemoteFile rf=TestRemoteFile.getInstance(testFile,false,false,true);
  ((TestRemoteFile)rf).failsOnCopy=true;
  UploadMessage msg=new UploadMessage(anyBa,arcReposQ,rf);
  bas.visit(msg);
  conn.waitForConcurrentTasksToFinish();
  assertEquals("String_Node_Str" + anyBa + "String_Node_Str"+ expectedListeners+ "String_Node_Str",expectedListeners,conn.getListeners(anyBa).size());
  assertTrue("String_Node_Str",listener.messagesReceived.size() >= 1);
  assertEquals("String_Node_Str",msg,listener.messagesReceived.get(0));
  assertFalse("String_Node_Str",((NetarkivetMessage)listener.messagesReceived.get(0)).isOk());
}

Fixed version (ground truth):
public void testListenerNotRemovedOnErrors(){
  bas=BitarchiveServer.getInstance();
  ChannelID arcReposQ=Channels.getTheRepos();
  ChannelID anyBa=Channels.getAnyBa();
  JMSConnectionMockupMQ conn=(JMSConnectionMockupMQ)JMSConnectionFactory.getInstance();
  GenericMessageListener listener=new GenericMessageListener();
  conn.setListener(arcReposQ,listener);
  int expectedListeners=1;
  assertEquals("String_Node_Str" + anyBa + "String_Node_Str"+ expectedListeners+ "String_Node_Str",expectedListeners,conn.getListeners(anyBa).size());
  File testFile=TestInfo.UPLOADMESSAGE_TESTFILE_1;
  RemoteFile rf=TestRemoteFile.getInstance(testFile,false,false,true);
  ((TestRemoteFile)rf).failsOnCopy=true;
  UploadMessage msg=new UploadMessage(anyBa,arcReposQ,rf);
  JMSConnectionMockupMQ.updateMsgID(msg,"String_Node_Str");
  bas.visit(msg);
  conn.waitForConcurrentTasksToFinish();
  assertEquals("String_Node_Str" + anyBa + "String_Node_Str"+ expectedListeners+ "String_Node_Str",expectedListeners,conn.getListeners(anyBa).size());
  assertTrue("String_Node_Str",listener.messagesReceived.size() >= 1);
  assertEquals("String_Node_Str",msg,listener.messagesReceived.get(0));
  assertFalse("String_Node_Str",((NetarkivetMessage)listener.messagesReceived.get(0)).isOk());
}
Program: 89923
Project: 89923
Buggy source:
/** 
 * The message for handling the results of the GetChecksumMessage.
 * @param msg The message containing the checksum of a specific file.
 */
public void onChecksumReply(GetChecksumMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  log.debug("String_Node_Str" + msg.toString());
  if (!outstandingChecksumFiles.containsKey(msg.getID())) {
    log.warn("String_Node_Str" + "String_Node_Str" + msg.getReplyOfId() + "String_Node_Str"+ msg.toString()+ "String_Node_Str"+ outstandingChecksumFiles.keySet().toString());
    return;
  }
  String arcfileName=outstandingChecksumFiles.remove(msg.getReplyOfId());
  if (!msg.isOk()) {
    log.warn("String_Node_Str" + msg.getID() + "String_Node_Str"+ "String_Node_Str"+ msg.getErrMsg()+ "String_Node_Str"+ "String_Node_Str");
  }
  String orgChecksum=ad.getCheckSum(arcfileName);
  String repChannelName=resolveReplicaChannel(msg.getReplyTo().getName());
  String reportedChecksum=msg.getChecksum();
  if (orgChecksum.equals(reportedChecksum) && !reportedChecksum.isEmpty()) {
    ad.setState(arcfileName,repChannelName,BitArchiveStoreState.UPLOAD_COMPLETED);
  }
 else {
    log.warn("String_Node_Str" + arcfileName + "String_Node_Str"+ "String_Node_Str"+ orgChecksum+ "String_Node_Str"+ reportedChecksum+ "String_Node_Str");
    ad.setState(arcfileName,repChannelName,BitArchiveStoreState.UPLOAD_FAILED);
  }
  considerReplyingOnStore(arcfileName);
  log.debug("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * The message for handling the results of the GetChecksumMessage.
 * @param msg The message containing the checksum of a specific file.
 */
public void onChecksumReply(GetChecksumMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  log.debug("String_Node_Str" + msg.toString());
  if (!outstandingChecksumFiles.containsKey(msg.getID())) {
    log.warn("String_Node_Str" + "String_Node_Str" + msg.getReplyOfId() + "String_Node_Str"+ msg.toString()+ "String_Node_Str"+ outstandingChecksumFiles.keySet().toString());
    return;
  }
  String arcfileName=outstandingChecksumFiles.remove(msg.getID());
  if (!msg.isOk()) {
    log.warn("String_Node_Str" + msg.getID() + "String_Node_Str"+ "String_Node_Str"+ msg.getErrMsg()+ "String_Node_Str"+ "String_Node_Str");
  }
  String orgChecksum=ad.getCheckSum(arcfileName);
  String repChannelName=resolveReplicaChannel(msg.getReplyTo().getName());
  String reportedChecksum=msg.getChecksum();
  if (orgChecksum.equals(reportedChecksum) && !reportedChecksum.isEmpty()) {
    ad.setState(arcfileName,repChannelName,BitArchiveStoreState.UPLOAD_COMPLETED);
  }
 else {
    log.warn("String_Node_Str" + arcfileName + "String_Node_Str"+ "String_Node_Str"+ orgChecksum+ "String_Node_Str"+ reportedChecksum+ "String_Node_Str");
    ad.setState(arcfileName,repChannelName,BitArchiveStoreState.UPLOAD_FAILED);
  }
  considerReplyingOnStore(arcfileName);
  log.debug("String_Node_Str");
}
Program: 89924
Project: 89924
Buggy source:
/** 
 * Forwards a getfile message to requested bitarchive replica. Note that this circumvents the ArcRepository entirely and that the reply goes directly back to whoever set the message.
 * @param msg the message to be processed by the get command.
 * @throws ArgumentNotValid If one of the arguments are null.
 */
public void visit(GetFileMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  ReplicaClient bc=ar.getReplicaClientFromReplicaId(msg.getReplicaId());
  try {
    bc.getFile(msg);
  }
 catch (  Throwable t) {
    log.warn("String_Node_Str",t);
    msg.setNotOk(t);
    JMSConnectionFactory.getInstance().reply(msg);
  }
}

Fixed version (ground truth):
/** 
 * Method for retrieving all the checksums from a replica. Currently only checksum replicas.
 */
public void visit(GetAllChecksumMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  ReplicaClient cc=ar.getReplicaClientFromReplicaId(msg.getReplicaId());
  try {
    cc.getAllChecksums(msg);
  }
 catch (  Throwable t) {
    log.warn("String_Node_Str",t);
    msg.setNotOk(t);
    JMSConnectionFactory.getInstance().reply(msg);
  }
}
Program: 89925
Project: 89925
Buggy source:
@Override public GetAllFilenamesMessage getAllFilenames(){
  throw new NotImplementedException("String_Node_Str");
}

Fixed version (ground truth):
@Override public void getAllFilenames(GetAllFilenamesMessage msg){
  throw new NotImplementedException("String_Node_Str" + msg.toString() + "String_Node_Str");
}
Program: 89926
Project: 89926
Buggy source:
/** 
 * Forward the message to ALL_BA.
 * @param msg the message to forward
 */
public void removeAndGetFile(RemoveAndGetFileMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  con.resend(msg,this.all_ba);
}

Fixed version (ground truth):
/** 
 * Forward the message to ALL_BA.
 * @param msg the message to forward.
 */
public void removeAndGetFile(RemoveAndGetFileMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  con.resend(msg,this.all_ba);
}
Program: 89927
Project: 89927
Buggy source:
/** 
 * Submit an upload request to the bitarchive.
 * @param rf The file to upload
 * @throws IOFailure If access to file denied
 * @throws ArgumentNotValid    if arcfile is null
 */
public void upload(RemoteFile rf){
  ArgumentNotValid.checkNotNull(rf,"String_Node_Str");
  UploadMessage up=new UploadMessage(any_ba,clientId,rf);
  log.debug("String_Node_Str" + up.toString());
  con.send(up);
}

Fixed version (ground truth):
/** 
 * Submit an upload request to the bitarchive.
 * @param rf The file to upload.
 * @throws IOFailure If access to file denied.
 * @throws ArgumentNotValid If arcfile is null.
 */
public void upload(RemoteFile rf){
  ArgumentNotValid.checkNotNull(rf,"String_Node_Str");
  UploadMessage up=new UploadMessage(any_ba,clientId,rf);
  log.debug("String_Node_Str" + up.toString());
  con.send(up);
}
Program: 89928
Project: 89928
Buggy source:
/** 
 * Submit a batch job to the archive. This is used by the ArcRepository when it needs to run batch jobs for its own reasons (i.e. when checksumming a file as part of the Store operation.
 * @param replyChannel The channel that the reply of this job shouldbe sent to.
 * @param job The job that should be run on the bit archivehandled by this client.
 * @return The submitted message
 * @throws ArgumentNotValid if any parameter was null.
 * @throws IOFailure if sending the batch message did not succeed.
 */
public BatchMessage batch(ChannelID replyChannel,FileBatchJob job) throws ArgumentNotValid, IOFailure {
  ArgumentNotValid.checkNotNull(replyChannel,"String_Node_Str");
  ArgumentNotValid.checkNotNull(job,"String_Node_Str");
  BatchMessage bMsg=new BatchMessage(this.the_bamon,replyChannel,job,"String_Node_Str" + "String_Node_Str");
  con.send(bMsg);
  return bMsg;
}

Fixed version (ground truth):
/** 
 * Submit a batch job to the archive. This is used by the ArcRepository when it needs to run batch jobs for its own reasons (i.e. when checksumming a file as part of the Store operation.
 * @param replyChannel The channel that the reply of this job should be sent to.
 * @param job The job that should be run on the bit archive handled by thisclient.
 * @return The submitted message.
 * @throws ArgumentNotValid If any parameter was null.
 * @throws IOFailure If sending the batch message did not succeed.
 */
public BatchMessage batch(ChannelID replyChannel,FileBatchJob job) throws ArgumentNotValid, IOFailure {
  ArgumentNotValid.checkNotNull(replyChannel,"String_Node_Str");
  ArgumentNotValid.checkNotNull(job,"String_Node_Str");
  BatchMessage bMsg=new BatchMessage(this.the_bamon,replyChannel,job,"String_Node_Str" + "String_Node_Str");
  con.send(bMsg);
  return bMsg;
}
Program: 89929
Project: 89929
Buggy source:
/** 
 * This creates a batch job for retrieving the checksums.
 * @param arcName The name of the arcfile to retrieve the checksum from.
 */
@Override public GetChecksumMessage getChecksum(String arcName){
  throw new NotImplementedException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * This should creates a batch job for retrieving the checksum of the  wanted files.
 * @param msg The message.
 */
@Override public void getChecksum(GetChecksumMessage msg){
  throw new NotImplementedException("String_Node_Str");
}
Program: 89930
Project: 89930
Buggy source:
/** 
 * Submit an already constructed getfile message to the archive.
 * @param msg get file message to retrieve
 */
public void getFile(GetFileMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  log.debug("String_Node_Str" + msg + "String_Node_Str");
  con.resend(msg,this.all_ba);
}

Fixed version (ground truth):
/** 
 * Submit an already constructed getfile message to the archive.
 * @param msg get file message to retrieve.
 */
public void getFile(GetFileMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  log.debug("String_Node_Str" + msg + "String_Node_Str");
  con.resend(msg,this.all_ba);
}
Program: 89931
Project: 89931
Buggy source:
/** 
 * Create a single mbean object. This is a helper method for the constructor taking a domain, which take the domain from a preconstructed ObjectName and replaces the nameProperties with the properties from the given object name. Use this if you have an object name created already, which you wish to use.
 * @param name        The object name to register under.
 * @param o           The object to register.
 * @param asInterface The interface o should implement.
 * @param mBeanServer The mbean server to register o in.
 * @throws ArgumentNotValid on any null parameter.
 */
public SingleMBeanObject(ObjectName name,I o,Class<I> asInterface,MBeanServer mBeanServer){
  this(name.getDomain(),o,asInterface,mBeanServer);
  nameProperties.clear();
  nameProperties.putAll((Hashtable<String,String>)name.getKeyPropertyList());
}

Fixed version (ground truth):
/** 
 * Create a single mbean object. This is a helper method for the constructor taking a domain, which take the domain from a preconstructed ObjectName and replaces the nameProperties with the properties from the given object name. Use this if you have an object name created already, which you wish to use.
 * @param name        The object name to register under.
 * @param o           The object to register.
 * @param asInterface The interface o should implement.
 * @param mBeanServer The mbean server to register o in.
 * @throws ArgumentNotValid on any null parameter.
 */
public SingleMBeanObject(ObjectName name,I o,Class<I> asInterface,MBeanServer mBeanServer){
  this(name.getDomain(),o,asInterface,mBeanServer);
  nameProperties.clear();
  nameProperties.putAll(name.getKeyPropertyList());
}
Program: 89932
Project: 89932
Buggy source:
/** 
 * Properties for the ObjectName name. Update these before registering. On construction, initialised with location, hostname, httpport, priority, replica applicationname, applicationinstid.
 */
public Hashtable<String,String> getNameProperties(){
  return nameProperties;
}

Fixed version (ground truth):
/** 
 * Properties for the ObjectName name. Update these before registering. On construction, initialised with location, hostname, httpport, priority, replica, applicationname, applicationinstid.
 * @return Hashtable of the object name properties.
 */
public Hashtable<String,String> getNameProperties(){
  return nameProperties;
}
Program: 89933
Project: 89933
Buggy source:
/** 
 * @return the name
 */
public ObjectName getName(){
  return name;
}

Fixed version (ground truth):
/** 
 * @return the name 
 */
public ObjectName getName(){
  return name;
}
Program: 89934
Project: 89934
Buggy source:
/** 
 * Registers this object as a standard MBean, with a name generated from domain given in constructor and the nameProperties hashTable.
 * @throws IllegalState if bean is already registered.
 * @throws IOFailure on trouble registering.
 */
public void register(){
  try {
    name=new ObjectName(domain,nameProperties);
    mBeanServer.registerMBean(new StandardMBean(exposedObject,asInterface),name);
    log.trace("String_Node_Str" + name + "String_Node_Str");
  }
 catch (  InstanceAlreadyExistsException e) {
    String msg="String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str";
    log.warn(msg,e);
    throw new IllegalState(msg,e);
  }
catch (  JMException e) {
    throw new IOFailure("String_Node_Str" + name + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Registers this object as a standard MBean, with a name generated from domain given in constructor and the nameProperties hashTable.
 * @throws IllegalState if bean is already registered.
 * @throws IOFailure    on trouble registering.
 */
public void register(){
  try {
    name=new ObjectName(domain,nameProperties);
    mBeanServer.registerMBean(new StandardMBean(exposedObject,asInterface),name);
    log.trace("String_Node_Str" + name + "String_Node_Str");
  }
 catch (  InstanceAlreadyExistsException e) {
    String msg="String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str";
    log.warn(msg,e);
    throw new IllegalState(msg,e);
  }
catch (  JMException e) {
    throw new IOFailure("String_Node_Str" + name + "String_Node_Str",e);
  }
}
Program: 89935
Project: 89935
Buggy source:
/** 
 * hashCode method, that overrides the Object.hashCode method.
 * @see Object#hashCode()
 * @return the hashcode for this object
 */
public int hashCode(){
  int result;
  result=server.hashCode();
  result=31 * result + port;
  result=31 * result + rmiPort;
  result=31 * result + userName.hashCode();
  result=31 * result + password.hashCode();
  return result;
}

Fixed version (ground truth):
/** 
 * hashCode method, that overrides the Object.hashCode method.
 * @return the hashcode for this object
 * @see Object#hashCode()
 */
public int hashCode(){
  int result;
  result=server.hashCode();
  result=31 * result + port;
  result=31 * result + rmiPort;
  result=31 * result + userName.hashCode();
  result=31 * result + password.hashCode();
  return result;
}
Program: 89936
Project: 89936
Buggy source:
/** 
 * Equals method, that overrides the Object.equals method.
 * @see Object#equals(java.lang.Object)
 * @param o anObject
 * @return true, if o is equal to this object; else false
 */
public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  CacheKey cacheKey=(CacheKey)o;
  if (port != cacheKey.port)   return false;
  if (rmiPort != cacheKey.rmiPort)   return false;
  if (!password.equals(cacheKey.password))   return false;
  if (!server.equals(cacheKey.server))   return false;
  if (!userName.equals(cacheKey.userName))   return false;
  return true;
}

Fixed version (ground truth):
/** 
 * Equals method, that overrides the Object.equals method.
 * @param o anObject
 * @return true, if o is equal to this object; else false
 * @see Object#equals(java.lang.Object)
 */
public boolean equals(Object o){
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  CacheKey cacheKey=(CacheKey)o;
  if (port != cacheKey.port) {
    return false;
  }
  if (rmiPort != cacheKey.rmiPort) {
    return false;
  }
  if (!password.equals(cacheKey.password)) {
    return false;
  }
  if (!server.equals(cacheKey.server)) {
    return false;
  }
  if (!userName.equals(cacheKey.userName)) {
    return false;
  }
  return true;
}
Program: 89937
Project: 89937
Buggy source:
/** 
 * Constructor for this class. 
 */
public CacheKey(String server,int port,int rmiPort,String userName,String password){
  this.server=server;
  this.port=port;
  this.rmiPort=rmiPort;
  this.userName=userName;
  this.password=password;
}

Fixed version (ground truth):
/** 
 * Constructor for this class.
 * @param server   The server name.
 * @param port     The JMX port number.
 * @param rmiPort  The RMI callback number.
 * @param userName The JMX user name.
 * @param password The JMX password.
 */
public CacheKey(String server,int port,int rmiPort,String userName,String password){
  this.server=server;
  this.port=port;
  this.rmiPort=rmiPort;
  this.userName=userName;
  this.password=password;
}
Program: 89938
Project: 89938
Buggy source:
/** 
 * Check that IOFailure is thrown by the JMXHeritrixController if the JMXPasswordFile does not exist / is hidden / unreadable / impossible to open for other reasons. 
 */
public void testIOFailureThrown() throws IOException {
  File passwordFile=new File(TestInfo.WORKING_DIR,"String_Node_Str");
  FileUtils.remove(passwordFile);
  File tempDir=mtf.newTmpDir();
  hl=getHeritrixLauncher(TestInfo.DEFAULT_ORDERXML_FILE,TestInfo.SEEDS_FILE,tempDir,passwordFile,new File(Settings.get(CommonSettings.JMX_ACCESS_FILE)));
  try {
    hl.doCrawl();
    fail("String_Node_Str" + "String_Node_Str" + passwordFile.getAbsolutePath() + "String_Node_Str");
  }
 catch (  IOFailure iof) {
    assertTrue("String_Node_Str" + iof,iof.getMessage().contains("String_Node_Str"));
  }
catch (  Exception ex) {
    if (!ex.getCause().getMessage().contains("String_Node_Str" + passwordFile.getAbsolutePath() + "String_Node_Str")) {
      fail("String_Node_Str" + "String_Node_Str" + passwordFile.getAbsolutePath() + "String_Node_Str"+ ex);
    }
  }
}

Fixed version (ground truth):
/** 
 * Check that IOFailure is thrown by the JMXHeritrixController if the JMXPasswordFile does not exist / is hidden / unreadable / impossible to open for other reasons. 
 */
public void testIOFailureThrown() throws IOException {
  File passwordFile=new File(TestInfo.WORKING_DIR,"String_Node_Str");
  FileUtils.remove(passwordFile);
  File tempDir=mtf.newTmpDir();
  hl=getHeritrixLauncher(TestInfo.DEFAULT_ORDERXML_FILE,TestInfo.SEEDS_FILE,tempDir,passwordFile,new File(Settings.get(CommonSettings.JMX_ACCESS_FILE)));
  try {
    hl.doCrawl();
    fail("String_Node_Str" + "String_Node_Str" + passwordFile.getAbsolutePath() + "String_Node_Str");
  }
 catch (  IOFailure iof) {
    assertTrue("String_Node_Str" + iof,iof.getMessage().contains("String_Node_Str"));
  }
catch (  Exception ex) {
    if (!ex.getCause().getMessage().contains("String_Node_Str" + passwordFile.getAbsolutePath() + "String_Node_Str")) {
      ex.printStackTrace();
      fail("String_Node_Str" + "String_Node_Str" + passwordFile.getAbsolutePath() + "String_Node_Str"+ ExceptionUtils.getStackTrace(ex));
    }
  }
}
Program: 89939
Project: 89939
Buggy source:
public CorrectMessage(ChannelID to,ChannelID replyTo,String checksum,RemoteFile file){
  super(to,replyTo,CORRECT_MESSAGE_PREFIX);
  ArgumentNotValid.checkNotNull(file,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(checksum,"String_Node_Str");
  this.theChecksum=checksum;
  this.theRemoteFile=file;
  this.arcFilename=file.getName();
}

Fixed version (ground truth):
public CorrectMessage(ChannelID to,ChannelID replyTo,String checksum,RemoteFile file){
  super(to,replyTo);
  ArgumentNotValid.checkNotNull(file,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(checksum,"String_Node_Str");
  this.theChecksum=checksum;
  this.theRemoteFile=file;
  this.arcFilename=file.getName();
}
Program: 89940
Project: 89940
Buggy source:
/** 
 * Constructor.
 * @param to Where this message is headed.
 * @param replyTo Where the reply on this message is sent.
 * @param repId The replica where the job involved in this message isto be performed.
 */
public GetAllChecksumMessage(ChannelID to,ChannelID replyTo,String repId){
  super(to,replyTo,GET_ALL_CHECKSUM_MESSAGE_PREFIX);
  this.replicaId=repId;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param to Where this message is headed.
 * @param replyTo Where the reply on this message is sent.
 * @param repId The replica where the job involved in this message isto be performed.
 */
public GetAllChecksumMessage(ChannelID to,ChannelID replyTo,String repId){
  super(to,replyTo);
  this.replicaId=repId;
}
Program: 89941
Project: 89941
Buggy source:
/** 
 * Constructor.
 * @param to The channel the message is sent to.
 * @param replyTo The channel the reply is sent to.
 */
public GetAllFilenamesMessage(ChannelID to,ChannelID replyTo,String repId){
  super(to,replyTo,IDPREFIX);
  this.replicaId=repId;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param to The channel the message is sent to.
 * @param replyTo The channel the reply is sent to.
 */
public GetAllFilenamesMessage(ChannelID to,ChannelID replyTo,String repId){
  super(to,replyTo);
  this.replicaId=repId;
}
Program: 89942
Project: 89942
Buggy source:
/** 
 * Constructor.
 * @param to Where this message should be sent.
 * @param replyTo Where the reply for this message should be sent.
 * @param filename The name of the file.
 */
protected GetChecksumMessage(ChannelID to,ChannelID replyTo,String filename){
  super(to,replyTo,GET_CHECKSUM_MESSAGE_PREFIX);
  ArgumentNotValid.checkNotNull(to,"String_Node_Str");
  ArgumentNotValid.checkNotNull(replyTo,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(filename,"String_Node_Str");
  arcFilename=filename;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param to Where this message should be sent.
 * @param replyTo Where the reply for this message should be sent.
 * @param filename The name of the file.
 */
protected GetChecksumMessage(ChannelID to,ChannelID replyTo,String filename){
  super(to,replyTo);
  ArgumentNotValid.checkNotNull(to,"String_Node_Str");
  ArgumentNotValid.checkNotNull(replyTo,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(filename,"String_Node_Str");
  arcFilename=filename;
}
Program: 89943
Project: 89943
Buggy source:
/** 
 * Test a valid BitarchiveClient is returned.
 */
public void testGetBitarchiveClientFromLocationName(){
  ArcRepository a=ArcRepository.getInstance();
  String[] locations=Settings.getAll(CommonSettings.REPLICA_IDS);
  for (int n=0; n < locations.length; n++) {
    BitarchiveClient bc=a.getBitarchiveClientFromReplicaId(locations[n]);
    assertNotNull("String_Node_Str",bc);
  }
}

Fixed version (ground truth):
/** 
 * Test a valid BitarchiveClient is returned.
 */
public void testGetBitarchiveClientFromLocationName(){
  ArcRepository a=ArcRepository.getInstance();
  String[] locations=Settings.getAll(CommonSettings.REPLICA_IDS);
  for (int n=0; n < locations.length; n++) {
    ReplicaClient bc=a.getReplicaClientFromReplicaId(locations[n]);
    assertNotNull("String_Node_Str",bc);
  }
}
Program: 89944
Project: 89944
Buggy source:
/** 
 * Test parameters.
 */
public void testGetBitarchiveClientFromLocationNameParameters(){
  ArcRepository a=ArcRepository.getInstance();
  try {
    a.getBitarchiveClientFromReplicaId(null);
    fail("String_Node_Str");
  }
 catch (  ArgumentNotValid e) {
  }
  try {
    a.getBitarchiveClientFromReplicaId("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  ArgumentNotValid e) {
  }
}

Fixed version (ground truth):
/** 
 * Test parameters.
 */
public void testGetBitarchiveClientFromLocationNameParameters(){
  ArcRepository a=ArcRepository.getInstance();
  try {
    a.getReplicaClientFromReplicaId(null);
    fail("String_Node_Str");
  }
 catch (  ArgumentNotValid e) {
  }
  try {
    a.getReplicaClientFromReplicaId("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  ArgumentNotValid e) {
  }
}
Program: 89945
Project: 89945
Buggy source:
/** 
 * Writes metadata to an ARC with the following name: <jobid>-preharvest-metadata-1.arc.
 * @param harvestJob a given Job.
 * @param metadata   the list of metadata entries to write to ARC.
 * @param crawlDir   the directory, where the ARC-file will be written.
 * @throws IOFailure If there are errors in writing the ARC file.
 */
private void writePreharvestMetadata(Job harvestJob,List<MetadataEntry> metadata,File crawlDir) throws IOFailure {
  if (metadata.size() == 0) {
    return;
  }
  File arcFile=new File(crawlDir,HarvestDocumentation.getPreharvestMetadataARCFileName(harvestJob.getJobID()));
  try {
    ARCWriter aw=null;
    try {
      aw=ARCUtils.createARCWriter(arcFile);
      for (      MetadataEntry m : metadata) {
        ByteArrayOutputStream baos=new ByteArrayOutputStream();
        baos.write(m.getData());
        aw.write(m.getURL(),m.getMimeType(),SystemUtils.getLocalIP(),System.currentTimeMillis(),baos.size(),baos);
      }
    }
  finally {
      try {
        if (aw != null) {
          aw.close();
        }
      }
 catch (      IOException e) {
        log.warn("String_Node_Str" + aw.getFile().getAbsolutePath() + "String_Node_Str",e);
      }
    }
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str" + harvestJob.getJobID() + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Writes metadata to an ARC with the following name: <jobid>-preharvest-metadata-1.arc.
 * @param harvestJob a given Job.
 * @param metadata   the list of metadata entries to write to ARC.
 * @param crawlDir   the directory, where the ARC-file will be written.
 * @throws IOFailure If there are errors in writing the ARC file.
 */
private void writePreharvestMetadata(Job harvestJob,List<MetadataEntry> metadata,File crawlDir) throws IOFailure {
  if (metadata.size() == 0) {
    return;
  }
  File arcFile=new File(crawlDir,HarvestDocumentation.getPreharvestMetadataARCFileName(harvestJob.getJobID()));
  try {
    ARCWriter aw=null;
    try {
      aw=ARCUtils.createARCWriter(arcFile);
      for (      MetadataEntry m : metadata) {
        ByteArrayInputStream bais=new ByteArrayInputStream(m.getData());
        aw.write(m.getURL(),m.getMimeType(),SystemUtils.getLocalIP(),System.currentTimeMillis(),m.getData().length,bais);
      }
    }
  finally {
      try {
        if (aw != null) {
          aw.close();
        }
      }
 catch (      IOException e) {
        log.warn("String_Node_Str" + aw.getFile().getAbsolutePath() + "String_Node_Str",e);
      }
    }
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str" + harvestJob.getJobID() + "String_Node_Str",e);
  }
}
Program: 89946
Project: 89946
Buggy source:
/** 
 * Retrieve the list of jobs for deduplicate reduction. Runs through all metadata entries, finding duplicate reduction entries, and parsing all jobIDs in them, warning only on errors.
 * @param metadataEntries list of metadataEntries
 * @return the list of jobs for deduplicate reduction
 */
private List<Long> parseJobIDsForDuplicateReduction(List<MetadataEntry> metadataEntries){
  List<Long> result=new ArrayList<Long>();
  for (  MetadataEntry me : metadataEntries) {
    if (me.isDuplicateReductionMetadataEntry()) {
      String s=new String(me.getData());
      String[] longs=s.split("String_Node_Str");
      for (      String stringLong : longs) {
        try {
          result.add(Long.valueOf(Long.parseLong(stringLong)));
        }
 catch (        NumberFormatException e) {
          log.warn("String_Node_Str" + stringLong + "String_Node_Str"+ "String_Node_Str"+ s+ "String_Node_Str",e);
        }
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Retrieve the list of jobs for deduplicate reduction. Runs through all metadata entries, finding duplicate reduction entries, and parsing all jobIDs in them, warning only on errors.
 * @param metadataEntries list of metadataEntries
 * @return the list of jobs for deduplicate reduction
 */
private List<Long> parseJobIDsForDuplicateReduction(List<MetadataEntry> metadataEntries){
  List<Long> result=new ArrayList<Long>();
  for (  MetadataEntry me : metadataEntries) {
    if (me.isDuplicateReductionMetadataEntry()) {
      String s=new String(me.getData());
      String[] longs=s.split("String_Node_Str");
      for (      String stringLong : longs) {
        try {
          result.add(Long.getLong(stringLong));
        }
 catch (        NumberFormatException e) {
          log.warn("String_Node_Str" + stringLong + "String_Node_Str"+ "String_Node_Str"+ s+ "String_Node_Str",e);
        }
      }
    }
  }
  return result;
}
Program: 89947
Project: 89947
Buggy source:
/** 
 * Turns a raw CDX file for the given jobID into a metadatafile containing the CDX lines in one ARC entry per ARC file indexed. The output is put into a file called &lt;jobID&gt;-metadata-1.arc.
 * @param resultFile The CDX file returned by a ExtractCDXJob for thegiven jobID.
 * @param jobID The jobID we work on.
 * @throws IOException If an I/O error occurs, or the resultFiledoes not exist
 */
private void arcifyResultFile(File resultFile,long jobID) throws IOException {
  BufferedReader reader=new BufferedReader(new FileReader(resultFile));
  try {
    ARCWriter writer=ARCUtils.createARCWriter(new File(HarvestDocumentation.getMetadataARCFileName(Long.toString(jobID))));
    try {
      String line;
      ByteArrayOutputStream baos=new ByteArrayOutputStream();
      String lastFilename=null;
      FileUtils.FilenameParser parser=null;
      while ((line=reader.readLine()) != null) {
        parser=parseLine(line,jobID);
        if (parser == null) {
          continue;
        }
        if (!parser.getFilename().equals(lastFilename)) {
          writeCDXEntry(writer,parser,baos);
          lastFilename=parser.getFilename();
        }
        baos.write(line.getBytes());
        baos.write("String_Node_Str".getBytes());
      }
      if (parser != null) {
        writeCDXEntry(writer,parser,baos);
      }
    }
  finally {
      writer.close();
    }
  }
  finally {
    reader.close();
  }
}

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

Fixed version (ground truth):
/** 
 * Writes a full entry of CDX files to the ARCWriter.
 * @param writer The writer we're currently writing to.
 * @param parser The filename of all the entries stored in baos.  Thisis used to generate the URI for the entry.
 * @param bytes The bytes of the CDX records to be written under thisentry.
 * @throws IOFailure if the write fails for any reason
 */
private void writeCDXEntry(ARCWriter writer,FileUtils.FilenameParser parser,byte[] bytes) throws IOFailure {
  try {
    ByteArrayInputStream bais=new ByteArrayInputStream(bytes);
    writer.write(HarvestDocumentation.getCDXURI(parser.getHarvestID(),parser.getJobID(),parser.getTimeStamp(),parser.getSerialNo()).toString(),Constants.CDX_MIME_TYPE,SystemUtils.getLocalIP(),System.currentTimeMillis(),bytes.length,bais);
  }
 catch (  IOException e) {
    throw new IOFailure("String_Node_Str" + "String_Node_Str" + parser.getFilename(),e);
  }
}