nus-yam/ex-repair huggingface dataset:
Program: 4703
Project: 4703
Buggy source:
/** 
 * Creates a RequeryDownloader to finish downloading incompleteFile.  This constructor has preconditions on several parameters; putting the burden on the caller makes the method easier to implement, since the superclass constructor immediately starts a download thread.
 * @param incompleteFile the incomplete file to resume to, whichMUST be the result of IncompleteFileManager.getFile.
 * @param name the name of the completed file, which MUST be the result ofIncompleteFileManager.getCompletedName(incompleteFile)
 * @param size the size of the completed file, which MUST be the result ofIncompleteFileManager.getCompletedSize(incompleteFile) 
 */
public ResumeDownloader(IncompleteFileManager incompleteFileManager,File incompleteFile,String name,int size){
  super(new RemoteFileDesc[0],incompleteFileManager);
  this._incompleteFile=incompleteFile;
  this._name=name;
  this._size=size;
  this._hash=incompleteFileManager.getCompletedHash(incompleteFile);
}

Fixed version (ground truth):
/** 
 * Creates a RequeryDownloader to finish downloading incompleteFile.  This constructor has preconditions on several parameters; putting the burden on the caller makes the method easier to implement, since the superclass constructor immediately starts a download thread.
 * @param incompleteFile the incomplete file to resume to, whichMUST be the result of IncompleteFileManager.getFile.
 * @param name the name of the completed file, which MUST be the result ofIncompleteFileManager.getCompletedName(incompleteFile)
 * @param size the size of the completed file, which MUST be the result ofIncompleteFileManager.getCompletedSize(incompleteFile) 
 */
public ResumeDownloader(IncompleteFileManager incompleteFileManager,File incompleteFile,String name,int size){
  super(name,new RemoteFileDesc[0],incompleteFileManager);
  this._incompleteFile=incompleteFile;
  this._name=name;
  this._size=size;
  this._hash=incompleteFileManager.getCompletedHash(incompleteFile);
}
Program: 4704
Project: 4704
Buggy source:
/** 
 * Tests URN queries from the leaf.
 */
public void testUrnQueryFromLeaf() throws Exception {
  QueryRequest qr=QueryRequest.createRequery(HugeTestUtils.SHA1);
  LEAF.send(qr);
  LEAF.flush();
  Message m=ULTRAPEER_1.receive(TIMEOUT);
  assertQuery(m);
  QueryRequest qrRead=(QueryRequest)m;
  assertTrue("String_Node_Str",Arrays.equals(qr.getGUID(),qrRead.getGUID()));
  m=ULTRAPEER_2.receive(TIMEOUT);
  assertQuery(m);
  qrRead=(QueryRequest)m;
  assertTrue("String_Node_Str",Arrays.equals(qr.getGUID(),qrRead.getGUID()));
  qr=QueryRequest.createRequery(HugeTestUtils.SHA1,(byte)2);
  LEAF.send(qr);
  LEAF.flush();
  assertTrue("String_Node_Str",!drainQuery(ULTRAPEER_2));
  assertTrue("String_Node_Str",!drainQuery(ULTRAPEER_1));
}

Fixed version (ground truth):
/** 
 * Tests URN queries from the leaf.
 */
public void testUrnQueryFromLeaf() throws Exception {
  QueryRequest qr=QueryRequest.createRequery(HugeTestUtils.SHA1);
  LEAF.send(qr);
  LEAF.flush();
  Message m=ULTRAPEER_1.receive(TIMEOUT);
  assertQuery(m);
  QueryRequest qrRead=(QueryRequest)m;
  assertTrue("String_Node_Str",Arrays.equals(qr.getGUID(),qrRead.getGUID()));
  m=ULTRAPEER_2.receive(TIMEOUT);
  assertQuery(m);
  qrRead=(QueryRequest)m;
  assertTrue("String_Node_Str",Arrays.equals(qr.getGUID(),qrRead.getGUID()));
  qr=QueryRequest.createRequery(HugeTestUtils.SHA1,(byte)2);
  LEAF.send(qr);
  LEAF.flush();
  assertTrue("String_Node_Str",!drain(ULTRAPEER_2));
  assertTrue("String_Node_Str",!drain(ULTRAPEER_1));
}
Program: 4705
Project: 4705
Buggy source:
public void testMisroutedPong() throws Exception {
  drain(ULTRAPEER_2);
  drain(LEAF);
  Message m=new PingReply(GUID.makeGuid(),(byte)7,6399,new byte[4],0,0,false);
  ULTRAPEER_1.send(m);
  ULTRAPEER_1.flush();
  assertTrue("String_Node_Str",!drain(ULTRAPEER_2));
  assertTrue("String_Node_Str",!drain(LEAF));
}

Fixed version (ground truth):
/** 
 * Tests to make sure that pongs that had no entry in the routing tables (that had no corresponding ping) are not forwarded.
 */
public void testMisroutedPong() throws Exception {
  Message m=new PingReply(GUID.makeGuid(),(byte)6,7399,new byte[4],0,0,false);
  ULTRAPEER_1.send(m);
  ULTRAPEER_1.flush();
  assertTrue("String_Node_Str",!drain(ULTRAPEER_2));
  assertTrue("String_Node_Str",!drain(LEAF));
}
Program: 4706
Project: 4706
Buggy source:
public void testUltrapeerPong() throws Exception {
  drain(ULTRAPEER_2);
  drain(LEAF);
  byte[] guid=GUID.makeGuid();
  byte[] ip={(byte)18,(byte)239,(byte)0,(byte)143};
  Message m=new PingReply(guid,(byte)7,6399,ip,0,0,true);
  ULTRAPEER_1.send(m);
  ULTRAPEER_1.flush();
  m=LEAF.receive(TIMEOUT);
  assertTrue("String_Node_Str",m instanceof PingReply);
  assertEquals("String_Node_Str",6399,((PingReply)m).getPort());
  assertTrue("String_Node_Str",!drain(ULTRAPEER_2));
}

Fixed version (ground truth):
/** 
 * Tests that Ultrapeer pongs are correctly sent to leaves to provide them with distributed host data.
 */
public void testUltrapeerPong() throws Exception {
  byte[] guid=GUID.makeGuid();
  byte[] ip={(byte)18,(byte)239,(byte)0,(byte)143};
  Message m=new PingReply(guid,(byte)7,7399,ip,0,0,true);
  ULTRAPEER_1.send(m);
  ULTRAPEER_1.flush();
  m=LEAF.receive(TIMEOUT);
  assertTrue("String_Node_Str",m instanceof PingReply);
  assertEquals("String_Node_Str",7399,((PingReply)m).getPort());
  assertTrue("String_Node_Str",!drain(ULTRAPEER_2));
}
Program: 4707
Project: 4707
Buggy source:
private static FileDesc[] createFileDescs(){
  File[] files=CommonUtils.getResourceFile(FILE_PATH).listFiles();
  FileDesc[] fileDescs=new FileDesc[files.length];
  for (int i=0; i < files.length; i++) {
    Set urns=FileDesc.calculateAndCacheURN(files[i]);
    fileDescs[i]=new FileDesc(files[i],urns,i);
  }
  return fileDescs;
}

Fixed version (ground truth):
private static FileDesc[] createFileDescs(){
  File path=CommonUtils.getResourceFile(FILE_PATH);
  File[] files=path.listFiles(new FileFilter(){
    public boolean accept(    File file){
      return !file.isDirectory();
    }
  }
);
  FileDesc[] fileDescs=new FileDesc[files.length];
  for (int i=0; i < files.length; i++) {
    Set urns=FileDesc.calculateAndCacheURN(files[i]);
    fileDescs[i]=new FileDesc(files[i],urns,i);
  }
  return fileDescs;
}
Program: 4708
Project: 4708
Buggy source:
public void testDisallow(){
  guid[0]=(byte)0x41;
  guid[1]=(byte)0x61;
  guid[2]=(byte)0x42;
  guid[3]=(byte)0x62;
  guid[4]=(byte)0x5A;
  QueryRequest query=QueryRequest.createQuery("String_Node_Str",(byte)3);
  assertTrue(!filter.allow(query));
}

Fixed version (ground truth):
public void testDisallow(){
  guid[0]=(byte)0x41;
  guid[1]=(byte)0x61;
  guid[2]=(byte)0x42;
  guid[3]=(byte)0x62;
  guid[4]=(byte)0x5A;
  QueryRequest query=QueryRequest.createQuery(guid,"String_Node_Str","String_Node_Str");
  assertTrue(!filter.allow(query));
}
Program: 4709
Project: 4709
Buggy source:
public void testAllow1(){
  guid[0]=(byte)0x41;
  guid[1]=(byte)0x61;
  guid[2]=(byte)0x42;
  guid[3]=(byte)0x62;
  guid[4]=(byte)0x5B;
  QueryRequest query=QueryRequest.createQuery("String_Node_Str",(byte)3);
  assertTrue(filter.allow(query));
}

Fixed version (ground truth):
public void testAllow1(){
  guid[0]=(byte)0x41;
  guid[1]=(byte)0x61;
  guid[2]=(byte)0x42;
  guid[3]=(byte)0x62;
  guid[4]=(byte)0x5B;
  QueryRequest query=QueryRequest.createQuery(guid,"String_Node_Str","String_Node_Str");
  assertTrue(filter.allow(query));
}
Program: 4710
Project: 4710
Buggy source:
public void testAllow2(){
  guid[0]=(byte)0x42;
  guid[1]=(byte)0x61;
  guid[2]=(byte)0x42;
  guid[3]=(byte)0x62;
  guid[4]=(byte)0x5A;
  QueryRequest query=QueryRequest.createQuery("String_Node_Str",(byte)3);
  assertTrue(filter.allow(query));
}

Fixed version (ground truth):
public void testAllow2(){
  guid[0]=(byte)0x42;
  guid[1]=(byte)0x61;
  guid[2]=(byte)0x42;
  guid[3]=(byte)0x62;
  guid[4]=(byte)0x5A;
  QueryRequest query=QueryRequest.createQuery(guid,"String_Node_Str","String_Node_Str");
  assertTrue(filter.allow(query));
}
Program: 4711
Project: 4711
Buggy source:
/** 
 * Generic serialization testing routing. 
 * @param file the serialized ResumeDownloader to read
 * @param expectHash true iff there should be a hash in the downloader 
 */
private void tSerialization(String file,boolean expectHash) throws IOException, ClassNotFoundException {
  ObjectInputStream in=new ObjectInputStream(new FileInputStream(CommonUtils.getResourceFile(filePath + file)));
  ResumeDownloader rd=(ResumeDownloader)in.readObject();
  QueryRequest qr=rd.newRequery(0);
  assertEquals("String_Node_Str",qr.getQuery());
  if (expectHash) {
    assertEquals(1,qr.getQueryUrns().size());
    assertEquals(hash,qr.getQueryUrns().iterator().next());
  }
 else {
    assertEquals(0,qr.getQueryUrns().size());
  }
}

Fixed version (ground truth):
/** 
 * Generic serialization testing routing. 
 * @param file the serialized ResumeDownloader to read
 * @param expectHash true iff there should be a hash in the downloader 
 */
private void tSerialization(String file,boolean expectHash) throws IOException, ClassNotFoundException {
  ObjectInputStream in=new ObjectInputStream(new FileInputStream(CommonUtils.getResourceFile(filePath + file)));
  ResumeDownloader rd=(ResumeDownloader)in.readObject();
  QueryRequest qr=rd.newRequery(1);
  if (expectHash) {
    assertEquals("String_Node_Str",1,qr.getQueryUrns().size());
    assertEquals("String_Node_Str",hash,qr.getQueryUrns().iterator().next());
    assertEquals("String_Node_Str","String_Node_Str",qr.getQuery());
  }
 else {
    assertEquals("String_Node_Str",0,qr.getQueryUrns().size());
    assertEquals("String_Node_Str","String_Node_Str",qr.getQuery());
  }
}
Program: 4712
Project: 4712
Buggy source:
/** 
 * Tests that the progress is not 0% while requerying. This issue was reported by Sam Berlin. 
 */
public void testRequeryProgress() throws Exception {
  ResumeDownloader downloader=newResumeDownloader();
  while (downloader.getState() != Downloader.WAITING_FOR_RESULTS) {
    if (downloader.getState() != Downloader.QUEUED)     assertEquals(Downloader.WAITING_FOR_RESULTS,downloader.getState());
    try {
      Thread.sleep(200);
    }
 catch (    InterruptedException e) {
    }
  }
  assertEquals(Downloader.WAITING_FOR_RESULTS,downloader.getState());
  assertEquals(amountDownloaded,downloader.getAmountRead());
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ObjectOutputStream out=new ObjectOutputStream(baos);
  out.writeObject(downloader);
  out.flush();
  out.close();
  downloader.stop();
  ObjectInputStream in=new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
  downloader=(ResumeDownloader)in.readObject();
  in.close();
  downloader.initialize(new DownloadManagerStub(),new FileManagerStub(),new ActivityCallbackStub());
  try {
    Thread.sleep(200);
  }
 catch (  InterruptedException e) {
  }
  assertEquals(Downloader.WAITING_FOR_RESULTS,downloader.getState());
  assertEquals(amountDownloaded,downloader.getAmountRead());
  downloader.stop();
}

Fixed version (ground truth):
/** 
 * Tests that the progress is not 0% while requerying. This issue was reported by Sam Berlin. 
 */
public void testRequeryProgress() throws Exception {
  ResumeDownloader downloader=newResumeDownloader();
  while (downloader.getState() != Downloader.WAITING_FOR_RESULTS) {
    if (downloader.getState() != Downloader.QUEUED)     assertEquals(Downloader.WAITING_FOR_RESULTS,downloader.getState());
    Thread.sleep(200);
  }
  assertEquals(Downloader.WAITING_FOR_RESULTS,downloader.getState());
  assertEquals(amountDownloaded,downloader.getAmountRead());
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ObjectOutputStream out=new ObjectOutputStream(baos);
  out.writeObject(downloader);
  out.flush();
  out.close();
  downloader.stop();
  ObjectInputStream in=new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
  downloader=(ResumeDownloader)in.readObject();
  in.close();
  downloader.initialize(new DownloadManagerStub(),new FileManagerStub(),new ActivityCallbackStub());
  try {
    Thread.sleep(200);
  }
 catch (  InterruptedException e) {
  }
  assertEquals(Downloader.WAITING_FOR_RESULTS,downloader.getState());
  assertEquals(amountDownloaded,downloader.getAmountRead());
  downloader.stop();
}
Program: 4713
Project: 4713
Buggy source:
/** 
 * Tests to make sure that queries are still created correctly if some of the potential data is not filled in, such as XML vs. no XML, URN vs. no URN, etc.
 */
public void testStillAcceptedIfOnlyPartsAreEmpty() throws Exception {
  QueryRequest qr=null;
  qr=QueryRequest.createQuery("String_Node_Str");
  qr=QueryRequest.createQuery("String_Node_Str","String_Node_Str");
  qr=QueryRequest.createRequery(HugeTestUtils.SHA1);
  byte[] payload=new byte[2 + 3];
  payload[2]=(byte)65;
  qr=QueryRequest.createNetworkQuery(new byte[16],(byte)0,(byte)0,payload);
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  baos.write((short)2);
  baos.write(0);
  baos.write(0);
  baos.write(HugeTestUtils.URNS[0].toString().getBytes());
  baos.write(0);
  qr=QueryRequest.createNetworkQuery(new byte[16],(byte)0,(byte)0,payload);
}

Fixed version (ground truth):
/** 
 * Tests to make sure that queries are still created correctly if some of the potential data is not filled in, such as XML vs. no XML, URN vs. no URN, etc.
 */
public void testStillAcceptedIfOnlyPartsAreEmpty() throws Exception {
  QueryRequest qr=null;
  byte[] payload=new byte[2 + 3];
  payload[2]=(byte)65;
  qr=QueryRequest.createNetworkQuery(new byte[16],(byte)0,(byte)0,payload);
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  baos.write((short)2);
  baos.write(0);
  baos.write(0);
  baos.write(HugeTestUtils.URNS[0].toString().getBytes());
  baos.write(0);
  qr=QueryRequest.createNetworkQuery(new byte[16],(byte)0,(byte)0,payload);
}
Program: 4714
Project: 4714
Buggy source:
/** 
 * Writes the specified query out to a stream and then reads the stream back in to make sure we end up with the same query we started with.
 * @param qr the query to check
 */
private void runIOChecks(QueryRequest qr){
  QueryRequest storedQuery=qr;
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  try {
    qr.write(baos);
    baos.flush();
  }
 catch (  IOException e) {
    e.printStackTrace();
    fail("String_Node_Str" + e);
  }
  ByteArrayInputStream bais=new ByteArrayInputStream(baos.toByteArray());
  QueryRequest qrTest=null;
  try {
    qrTest=(QueryRequest)Message.read(bais);
  }
 catch (  Exception e) {
    e.printStackTrace();
    fail("String_Node_Str" + e);
  }
}

Fixed version (ground truth):
/** 
 * Writes the specified query out to a stream and then reads the stream back in to make sure we end up with the same query we started with.
 * @param qr the query to check
 */
private void runIOChecks(QueryRequest qr){
  QueryRequest storedQuery=qr;
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  try {
    qr.write(baos);
    baos.flush();
  }
 catch (  IOException e) {
    e.printStackTrace();
    fail("String_Node_Str" + e);
  }
  ByteArrayInputStream bais=new ByteArrayInputStream(baos.toByteArray());
  QueryRequest qrTest=null;
  try {
    qrTest=(QueryRequest)Message.read(bais);
  }
 catch (  Exception e) {
    e.printStackTrace();
    fail("String_Node_Str" + e);
  }
  assertEquals("String_Node_Str",storedQuery,qrTest);
}
Program: 4715
Project: 4715
Buggy source:
/** 
 * Constructs and launches a new <tt>Backend</tt>.
 * @param reject true to launch a reject server
 */
private Backend(boolean reject) throws IOException {
  super("String_Node_Str");
  System.out.println(reject ? "String_Node_Str" : "String_Node_Str");
  int port=(reject ? REJECT_PORT : PORT);
  int shutdownPort=(reject ? SHUTDOWN_REJECT_PORT : SHUTDOWN_PORT);
  ServerSocket shutdownSocket=null;
  try {
    shutdownSocket=new ServerSocket(shutdownPort);
    preSetUp();
    setStandardSettings(port,reject);
    populateSharedDirectory();
    ROUTER_SERVICE=new RouterService(new ActivityCallbackStub());
    ROUTER_SERVICE.start();
    if (!reject)     ROUTER_SERVICE.connect();
    try {
      Thread.sleep(2000);
    }
 catch (    InterruptedException e) {
    }
    if (ROUTER_SERVICE.getPort() != port) {
      throw new IOException("String_Node_Str");
    }
    waitForShutdown(shutdownSocket);
    doShutdown(reject,"String_Node_Str");
  }
 catch (  Exception ex) {
    ErrorService.error(ex);
    doShutdown(reject,"String_Node_Str");
  }
 finally {
    try {
      if (shutdownSocket != null)       shutdownSocket.close();
    }
 catch (    IOException ex2) {
    }
    try {
      postTearDown();
    }
  finally {
      deleteFiles(_baseDir,true);
    }
  }
}

Fixed version (ground truth):
/** 
 * Constructs and launches a new <tt>Backend</tt>.
 * @param reject true to launch a reject server
 */
private Backend(boolean reject) throws IOException {
  super("String_Node_Str");
  System.out.println(reject ? "String_Node_Str" : "String_Node_Str");
  int port=(reject ? REJECT_PORT : PORT);
  int shutdownPort=(reject ? SHUTDOWN_REJECT_PORT : SHUTDOWN_PORT);
  ServerSocket shutdownSocket=null;
  try {
    shutdownSocket=new ServerSocket(shutdownPort);
    preSetUp();
    setStandardSettings(port,reject);
    populateSharedDirectory();
    ROUTER_SERVICE=new RouterService(new ActivityCallbackStub());
    ROUTER_SERVICE.start();
    if (!reject)     ROUTER_SERVICE.connect();
    try {
      Thread.sleep(2000);
    }
 catch (    InterruptedException e) {
    }
    if (ROUTER_SERVICE.getPort() != port) {
      throw new IOException("String_Node_Str");
    }
    waitForShutdown(shutdownSocket);
    doShutdown(reject,"String_Node_Str");
  }
 catch (  Exception ex) {
    ErrorService.error(ex);
    doShutdown(reject,"String_Node_Str");
  }
 finally {
    try {
      if (shutdownSocket != null)       shutdownSocket.close();
    }
 catch (    IOException ex2) {
    }
    try {
      postTearDown();
    }
  finally {
      cleanFiles(_baseDir,true);
    }
  }
}
Program: 4716
Project: 4716
Buggy source:
/** 
 * Tests requests that follow the traditional "get" syntax but that also include the X-Gnutella-Content-URN header.  In these requests, both the URN and the file name and index are correct, so a valid result is expected.
 */
public void testTraditionalGetWithContentUrn(){
  for (int i=0; i < _fileManager.getNumFiles(); i++) {
    FileDesc fd=_fileManager.get(i);
    sendRequestThatShouldSucceed(HTTPRequestMethod.GET,"String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str",fd);
    sendRequestThatShouldSucceed(HTTPRequestMethod.HEAD,"String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str",fd);
  }
}

Fixed version (ground truth):
/** 
 * Tests requests that follow the traditional "get" syntax but that also include the X-Gnutella-Content-URN header.  In these requests, both the URN and the file name and index are correct, so a valid result is expected.
 */
public void testTraditionalGetWithContentUrn(){
  for (int i=0; i < RouterService.getFileManager().getNumFiles(); i++) {
    FileDesc fd=RouterService.getFileManager().get(i);
    sendRequestThatShouldSucceed(HTTPRequestMethod.GET,"String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str",fd);
    sendRequestThatShouldSucceed(HTTPRequestMethod.HEAD,"String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str",fd);
  }
}
Program: 4718
Project: 4718
Buggy source:
/** 
 * Tests requests that follow the traditional "get" syntax to make sure that  the X-Gnutella-Content-URN header is always returned.
 */
public void testTraditionalGetForReturnedUrn(){
  for (int i=0; i < _fileManager.getNumFiles(); i++) {
    FileDesc fd=_fileManager.get(i);
    String request="String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str"+ HTTPHeaderName.GNUTELLA_CONTENT_URN.httpStringValue()+ "String_Node_Str"+ fd.getSHA1Urn()+ "String_Node_Str";
    sendRequestThatShouldSucceed(HTTPRequestMethod.GET,request,fd);
    sendRequestThatShouldSucceed(HTTPRequestMethod.HEAD,request,fd);
  }
}

Fixed version (ground truth):
/** 
 * Tests requests that follow the traditional "get" syntax to make sure that  the X-Gnutella-Content-URN header is always returned.
 */
public void testTraditionalGetForReturnedUrn(){
  for (int i=0; i < RouterService.getFileManager().getNumFiles(); i++) {
    FileDesc fd=RouterService.getFileManager().get(i);
    String request="String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str"+ HTTPHeaderName.GNUTELLA_CONTENT_URN.httpStringValue()+ "String_Node_Str"+ fd.getSHA1Urn()+ "String_Node_Str";
    sendRequestThatShouldSucceed(HTTPRequestMethod.GET,request,fd);
    sendRequestThatShouldSucceed(HTTPRequestMethod.HEAD,request,fd);
  }
}
Program: 4719
Project: 4719
Buggy source:
/** 
 * Tests get requests that follow the traditional Gnutella get format and that include an invalid content URN header -- these should fail with error code 404.
 */
public void testTraditionalGetWithInvalidContentUrn(){
  for (int i=0; i < _fileManager.getNumFiles(); i++) {
    FileDesc fd=_fileManager.get(i);
    String request="String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str"+ HTTPHeaderName.GNUTELLA_CONTENT_URN.httpStringValue()+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    sendRequestThatShouldFail(HTTPRequestMethod.GET,request,fd,STATUS_404);
    sendRequestThatShouldFail(HTTPRequestMethod.HEAD,request,fd,STATUS_404);
  }
}

Fixed version (ground truth):
/** 
 * Tests get requests that follow the traditional Gnutella get format and that include an invalid content URN header -- these should fail with error code 404.
 */
public void testTraditionalGetWithInvalidContentUrn(){
  for (int i=0; i < RouterService.getFileManager().getNumFiles(); i++) {
    FileDesc fd=RouterService.getFileManager().get(i);
    String request="String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str"+ HTTPHeaderName.GNUTELLA_CONTENT_URN.httpStringValue()+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    sendRequestThatShouldFail(HTTPRequestMethod.GET,request,fd,STATUS_404);
    sendRequestThatShouldFail(HTTPRequestMethod.HEAD,request,fd,STATUS_404);
  }
}
Program: 4720
Project: 4720
Buggy source:
/** 
 * Tests requests that follow the traditional "get" syntax to make sure that  the X-Gnutella-Content-URN header is always returned.
 */
public void testLimitReachedRequests(){
  int maxUploads=SettingsManager.instance().getMaxUploads();
  SettingsManager.instance().setMaxUploads(0);
  for (int i=0; i < _fileManager.getNumFiles(); i++) {
    FileDesc fd=_fileManager.get(i);
    String request="String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str"+ HTTPHeaderName.GNUTELLA_CONTENT_URN.httpStringValue()+ "String_Node_Str"+ fd.getSHA1Urn()+ "String_Node_Str";
    sendRequestThatShouldFail(HTTPRequestMethod.GET,request,fd,STATUS_503);
    sendRequestThatShouldFail(HTTPRequestMethod.HEAD,request,fd,STATUS_503);
  }
  SettingsManager.instance().setMaxUploads(maxUploads);
}

Fixed version (ground truth):
/** 
 * Tests requests that follow the traditional "get" syntax to make sure that  the X-Gnutella-Content-URN header is always returned.
 */
public void testLimitReachedRequests(){
  int maxUploads=SettingsManager.instance().getMaxUploads();
  SettingsManager.instance().setMaxUploads(0);
  for (int i=0; i < RouterService.getFileManager().getNumFiles(); i++) {
    FileDesc fd=RouterService.getFileManager().get(i);
    String request="String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str"+ HTTPHeaderName.GNUTELLA_CONTENT_URN.httpStringValue()+ "String_Node_Str"+ fd.getSHA1Urn()+ "String_Node_Str";
    sendRequestThatShouldFail(HTTPRequestMethod.GET,request,fd,STATUS_503);
  }
  SettingsManager.instance().setMaxUploads(maxUploads);
}
Program: 4721
Project: 4721
Buggy source:
/** 
 * Tests to make sure that invalid traditional Gnutella get requests with matching X-Gnutella-Content-URN header values also fail with 404.
 */
public void testInvalidTraditionalGetWithValidContentUrn(){
  for (int i=0; i < _fileManager.getNumFiles(); i++) {
    FileDesc fd=_fileManager.get(i);
    String request="String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str"+ "String_Node_Str"+ HTTPHeaderName.GNUTELLA_CONTENT_URN.httpStringValue()+ "String_Node_Str"+ fd.getSHA1Urn();
    sendRequestThatShouldFail(HTTPRequestMethod.GET,request,fd,STATUS_404);
    sendRequestThatShouldFail(HTTPRequestMethod.HEAD,request,fd,STATUS_404);
  }
}

Fixed version (ground truth):
/** 
 * Tests to make sure that invalid traditional Gnutella get requests with matching X-Gnutella-Content-URN header values also fail with 404.
 */
public void testInvalidTraditionalGetWithValidContentUrn(){
  for (int i=0; i < RouterService.getFileManager().getNumFiles(); i++) {
    FileDesc fd=RouterService.getFileManager().get(i);
    String request="String_Node_Str" + fd.getIndex() + "String_Node_Str"+ fd.getName()+ "String_Node_Str"+ "String_Node_Str"+ HTTPHeaderName.GNUTELLA_CONTENT_URN.httpStringValue()+ "String_Node_Str"+ fd.getSHA1Urn();
    sendRequestThatShouldFail(HTTPRequestMethod.GET,request,fd,STATUS_404);
    sendRequestThatShouldFail(HTTPRequestMethod.HEAD,request,fd,STATUS_404);
  }
}
Program: 4722
Project: 4722
Buggy source:
protected void setUp(){
  _testDir=new File(CommonUtils.getCurrentDirectory(),"String_Node_Str");
  if (!_testDir.isDirectory()) {
    _testDir=new File(CommonUtils.getCurrentDirectory(),"String_Node_Str");
  }
  if (!_testDir.isDirectory()) {
    _testDir=new File(CommonUtils.getCurrentDirectory(),"String_Node_Str");
  }
  if (!_testDir.isDirectory()) {
    _testDir=new File(CommonUtils.getCurrentDirectory(),"String_Node_Str");
  }
  assertTrue("String_Node_Str",_testDir.isDirectory());
  File flagsDir=new File(_testDir,"String_Node_Str");
  if (flagsDir.isDirectory()) {
    File[] files=flagsDir.listFiles();
    for (int i=0; i < files.length; i++) {
      if (!files[i].isFile())       continue;
      assertTrue("String_Node_Str",files[i].delete());
    }
  }
  File searchingFile=new File(_testDir,"String_Node_Str");
  searchingFile.delete();
  _fileManager=RouterService.getFileManager();
  _uploadManager=RouterService.getUploadManager();
  try {
    Thread.sleep(4000);
  }
 catch (  InterruptedException e) {
    assertTrue("String_Node_Str" + e,false);
  }
  assertTrue("String_Node_Str",4 < _fileManager.getNumFiles());
}

Fixed version (ground truth):
protected void setUp(){
  if (ROUTER_SERVICE.isStarted())   return;
  final File TEMP_DIR=new File("String_Node_Str");
  TEMP_DIR.mkdirs();
  TEMP_DIR.deleteOnExit();
  SettingsManager.instance().setDirectories(new File[]{TEMP_DIR});
  SettingsManager.instance().setExtensions("String_Node_Str");
  String dirString="String_Node_Str";
  File testDir=CommonUtils.getResourceFile(dirString);
  assertTrue("String_Node_Str",testDir.isDirectory());
  File[] files=testDir.listFiles();
  if (files != null) {
    for (int i=0; i < files.length; i++) {
      if (!files[i].isFile())       continue;
      CommonUtils.copyResourceFile(dirString + "String_Node_Str" + files[i].getName(),new File(TEMP_DIR,files[i].getName() + "String_Node_Str"));
    }
  }
  ROUTER_SERVICE.start();
  try {
    Thread.sleep(4000);
  }
 catch (  InterruptedException e) {
    assertTrue("String_Node_Str" + e,false);
  }
  assertTrue("String_Node_Str",4 < RouterService.getFileManager().getNumFiles());
}
Program: 4723
Project: 4723
Buggy source:
/** 
 * Sends an HTTP request that should fail if everything is working  correctly.
 */
private void sendRequestThatShouldFail(HTTPRequestMethod method,String request,FileDesc fd,String error){
  try {
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    baos.write(request.getBytes());
    Socket sock=new TestSocket(new ByteArrayInputStream(baos.toByteArray()));
    _uploadManager.acceptUpload(method,sock);
    String reply=sock.getOutputStream().toString();
    StringTokenizer st=new StringTokenizer(reply,"String_Node_Str");
    boolean sentExpectedError=false;
    while (st.hasMoreTokens()) {
      String curString=st.nextToken();
      if (curString.equals(error)) {
        sentExpectedError=true;
      }
    }
    assertTrue(error + "String_Node_Str",sentExpectedError);
  }
 catch (  IOException e) {
    assertTrue("String_Node_Str" + e,false);
  }
}

Fixed version (ground truth):
/** 
 * Sends an HTTP request that should fail if everything is working  correctly.
 */
private void sendRequestThatShouldFail(HTTPRequestMethod method,String request,FileDesc fd,String error){
  try {
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    baos.write(request.getBytes());
    Socket sock=new TestSocket(new ByteArrayInputStream(baos.toByteArray()));
    RouterService.getUploadManager().acceptUpload(method,sock);
    String reply=sock.getOutputStream().toString();
    StringTokenizer st=new StringTokenizer(reply,"String_Node_Str");
    boolean sentExpectedError=false;
    String curString=st.nextToken().trim();
    assertEquals("String_Node_Str",error,curString);
  }
 catch (  IOException e) {
    e.printStackTrace();
    fail("String_Node_Str" + e);
  }
}
Program: 4724
Project: 4724
Buggy source:
/** 
 * Test requests by URN.
 */
public void testHttpUrnRequest(){
  for (int i=0; i < _fileManager.getNumFiles(); i++) {
    FileDesc fd=_fileManager.get(i);
    String request="String_Node_Str" + fd.getSHA1Urn().httpStringValue() + "String_Node_Str";
    sendRequestThatShouldSucceed(HTTPRequestMethod.GET,request,fd);
    sendRequestThatShouldSucceed(HTTPRequestMethod.HEAD,request,fd);
  }
}

Fixed version (ground truth):
/** 
 * Test requests by URN.
 */
public void testHttpUrnRequest(){
  for (int i=0; i < RouterService.getFileManager().getNumFiles(); i++) {
    FileDesc fd=RouterService.getFileManager().get(i);
    String request="String_Node_Str" + fd.getSHA1Urn().httpStringValue() + "String_Node_Str";
    sendRequestThatShouldSucceed(HTTPRequestMethod.GET,request,fd);
    sendRequestThatShouldSucceed(HTTPRequestMethod.HEAD,request,fd);
  }
}
Program: 4726
Project: 4726
Buggy source:
/** 
 * @modifies socket, this' managers
 * @effects starts a new thread to handle the given socket andregisters it with the appropriate protocol-specific manager. Returns once the thread has been started.  If socket does not speak a known protocol, closes the socket immediately and returns.
 */
public ConnectionDispatchRunner(Socket socket){
  super("String_Node_Str");
  _socket=socket;
  setDaemon(true);
  start();
}

Fixed version (ground truth):
/** 
 * @modifies socket, this' managers
 * @effects starts a new thread to handle the given socket andregisters it with the appropriate protocol-specific manager. Returns once the thread has been started.  If socket does not speak a known protocol, closes the socket immediately and returns.
 */
public ConnectionDispatchRunner(Socket socket){
  super("String_Node_Str");
  _socket=socket;
  setDaemon(true);
  this.start();
}
Program: 4727
Project: 4727
Buggy source:
private String getLinuxMac() throws IOException {
  String result=runCommand("String_Node_Str");
  return parseResult(result,"String_Node_Str");
}

Fixed version (ground truth):
private String getLinuxMac() throws IOException {
  String result=runCommand("String_Node_Str");
  if (result.length() < 17)   result=runCommand("String_Node_Str");
  if (result.length() < 17)   result=runCommand("String_Node_Str");
  return parseResult(result,"String_Node_Str");
}
Program: 4728
Project: 4728
Buggy source:
private String parseResult(String result,String delimiter){
  StringTokenizer tok=new StringTokenizer(result,"String_Node_Str");
  while (tok.hasMoreTokens()) {
    String line=tok.nextToken();
    int index=line.indexOf(delimiter);
    if (index >= 0) {
      String address=line.substring(index + delimiter.length()).trim();
      address=canonicalizeMacAddress(address);
      if (address != null)       return address;
    }
  }
  return null;
}

Fixed version (ground truth):
private String parseResult(String result,String delimiter){
  result=result.toLowerCase();
  StringTokenizer tok=new StringTokenizer(result,"String_Node_Str");
  while (tok.hasMoreTokens()) {
    String line=tok.nextToken();
    int index=line.indexOf(delimiter);
    if (index >= 0) {
      String address=line.substring(index + delimiter.length()).trim();
      address=canonicalizeMacAddress(address);
      if (address != null)       return address;
    }
  }
  return null;
}
Program: 4729
Project: 4729
Buggy source:
/** 
 * Indirectly checks that the GWebCache is hit when there is no gnutella.net file. 
 */
public void testGetAnEndpoint_ImmediateFetch(){
  try {
    assertEquals(0,gWebCache.hostfiles);
    Thread responder=new Thread(){
      public void run(){
        hc.add(new Endpoint("String_Node_Str",6346),false);
        hc.add(new Endpoint("String_Node_Str",6346),false);
        hc.add(new Endpoint("String_Node_Str",6346),false);
      }
    }
;
    responder.start();
    assertTrue(hc.getAnEndpoint() != null);
    assertEquals(1,gWebCache.hostfiles);
    assertTrue(hc.getAnEndpoint() != null);
    assertEquals(1,gWebCache.hostfiles);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Indirectly checks that the GWebCache is hit when there is no gnutella.net file. 
 */
public void testGetAnEndpoint_ImmediateFetch(){
  try {
    assertEquals("String_Node_Str",0,gWebCache.hostfiles);
    Thread responder=new Thread(){
      public void run(){
        yield();
        hc.add(new Endpoint("String_Node_Str",6346),false);
      }
    }
;
    responder.start();
    assertTrue("String_Node_Str",hc.getAnEndpoint() != null);
    assertEquals("String_Node_Str",1,gWebCache.hostfiles);
    hc.add(new Endpoint("String_Node_Str",6346),false);
    assertTrue("String_Node_Str",hc.getAnEndpoint() != null);
    assertEquals("String_Node_Str",1,gWebCache.hostfiles);
    responder=new Thread(){
      public void run(){
        yield();
        hc.add(new Endpoint("String_Node_Str",6346),false);
      }
    }
;
    responder.start();
    assertTrue("String_Node_Str",hc.getAnEndpoint() != null);
    assertEquals("String_Node_Str",2,gWebCache.hostfiles);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
    fail("String_Node_Str");
  }
}
Program: 4730
Project: 4730
Buggy source:
public void setUp(){
  new RouterService(new ActivityCallbackStub());
  hc=new HostCatcher();
  gWebCache=new RecordingBootstrapServerManager();
  try {
    PrivilegedAccessor.setValue(hc,"String_Node_Str",gWebCache);
  }
 catch (  Exception e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void setUp(){
  new RouterService(new ActivityCallbackStub());
  gWebCache=new RecordingBootstrapServerManager();
  hc=new HostCatcher();
  try {
    PrivilegedAccessor.setValue(hc,"String_Node_Str",gWebCache);
  }
 catch (  Exception e) {
    fail("String_Node_Str");
  }
}
Program: 4731
Project: 4731
Buggy source:
public void run(){
  hc.add(new Endpoint("String_Node_Str",6346),false);
  hc.add(new Endpoint("String_Node_Str",6346),false);
  hc.add(new Endpoint("String_Node_Str",6346),false);
}

Fixed version (ground truth):
public void run(){
  yield();
  hc.add(new Endpoint("String_Node_Str",6346),false);
}
Program: 4733
Project: 4733
Buggy source:
/** 
 * Returns whether or not this node is capable of sending its own GUESS queries.  This would not be the case only if this node has not successfully received an incoming UDP packet.
 * @return <tt>true</tt> if this node is capable of running its ownGUESS queries, <tt>false</tt> otherwise
 */
public static boolean isGUESSCapable(){
  return udpService.isGUESSCapable() && SearchSettings.GUESS_ENABLED.getValue();
}

Fixed version (ground truth):
/** 
 * Returns whether or not this node is capable of sending its own GUESS queries.  This would not be the case only if this node has not successfully received an incoming UDP packet.
 * @return <tt>true</tt> if this node is capable of running its ownGUESS queries, <tt>false</tt> otherwise
 */
public static boolean isGUESSCapable(){
  return udpService.isGUESSCapable();
}
Program: 4735
Project: 4735
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTest(GGEPTest.suite());
  suite.addTest(PingReplyTest.suite());
  suite.addTest(PingRequestTest.suite());
  suite.addTest(PushRequestTest.suite());
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTest(GGEPTest.suite());
  suite.addTest(PingReplyTest.suite());
  suite.addTest(PingRequestTest.suite());
  suite.addTest(PushRequestTest.suite());
  suite.addTest(MessageUtilsTest.suite());
  return suite;
}
Program: 4736
Project: 4736
Buggy source:
private static void tAddDownload(){
  debug("String_Node_Str");
  final int RATE=500;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setRate(RATE);
  uploader2.setRate(RATE);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100);
  RemoteFileDesc rfd2=newRFDWithURN(6347,100);
  Downloader download=null;
  try {
    download=dm.download(new RemoteFileDesc[]{rfd1},false);
    ((ManagedDownloader)download).addDownload(rfd2);
  }
 catch (  FileExistsException e) {
    check(false,"String_Node_Str");
    return;
  }
catch (  AlreadyDownloadingException e) {
    check(false,"String_Node_Str");
    return;
  }
catch (  java.io.FileNotFoundException e) {
    check(false,"String_Node_Str");
    return;
  }
  waitForComplete(download);
  if (isComplete())   debug("String_Node_Str" + "String_Node_Str");
 else   check(false,"String_Node_Str");
  int u1=uploader1.amountUploaded();
  int u2=uploader2.amountUploaded();
  debug("String_Node_Str" + u1 + "String_Node_Str");
  debug("String_Node_Str" + u2 + "String_Node_Str");
  debug("String_Node_Str" + (u1 + u2) + "String_Node_Str");
  check(u1 < (TestFile.length() / 2 + (FUDGE_FACTOR)),"String_Node_Str");
  check(u2 < (TestFile.length() / 2 + (FUDGE_FACTOR)),"String_Node_Str");
}

Fixed version (ground truth):
private static void tAddDownload(){
  debug("String_Node_Str");
  final int RATE=500;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setRate(RATE);
  uploader2.setRate(RATE);
  RemoteFileDesc rfd1=newRFD(6346,100);
  RemoteFileDesc rfd2=newRFD(6347,100);
  Downloader download=null;
  try {
    download=dm.download(new RemoteFileDesc[]{rfd1},false);
    ((ManagedDownloader)download).addDownload(rfd2);
  }
 catch (  FileExistsException e) {
    check(false,"String_Node_Str");
    return;
  }
catch (  AlreadyDownloadingException e) {
    check(false,"String_Node_Str");
    return;
  }
catch (  java.io.FileNotFoundException e) {
    check(false,"String_Node_Str");
    return;
  }
  waitForComplete(download);
  if (isComplete())   debug("String_Node_Str" + "String_Node_Str");
 else   check(false,"String_Node_Str");
  int u1=uploader1.amountUploaded();
  int u2=uploader2.amountUploaded();
  debug("String_Node_Str" + u1 + "String_Node_Str");
  debug("String_Node_Str" + u2 + "String_Node_Str");
  debug("String_Node_Str" + (u1 + u2) + "String_Node_Str");
  check(u1 < (TestFile.length() / 2 + (FUDGE_FACTOR)),"String_Node_Str");
  check(u2 < (TestFile.length() / 2 + (FUDGE_FACTOR)),"String_Node_Str");
}
Program: 4737
Project: 4737
Buggy source:
private static void tUnbalancedSwarm(){
  debug("String_Node_Str");
  final int RATE=500;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setRate(RATE);
  uploader2.setRate(RATE / 10);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100);
  RemoteFileDesc rfd2=newRFDWithURN(6347,100);
  RemoteFileDesc[] rfds={rfd1,rfd2};
  tGeneric(rfds);
  int u1=uploader1.amountUploaded();
  int u2=uploader2.amountUploaded();
  debug("String_Node_Str" + u1 + "String_Node_Str");
  debug("String_Node_Str" + u2 + "String_Node_Str");
  debug("String_Node_Str" + (u1 + u2) + "String_Node_Str");
  check(u1 < 9 * TestFile.length() / 10 + FUDGE_FACTOR * 10,"String_Node_Str");
  check(u2 < TestFile.length() / 10 + FUDGE_FACTOR,"String_Node_Str");
}

Fixed version (ground truth):
private static void tUnbalancedSwarm(){
  debug("String_Node_Str");
  final int RATE=500;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setRate(RATE);
  uploader2.setRate(RATE / 10);
  RemoteFileDesc rfd1=newRFD(6346,100);
  RemoteFileDesc rfd2=newRFD(6347,100);
  RemoteFileDesc[] rfds={rfd1,rfd2};
  tGeneric(rfds);
  int u1=uploader1.amountUploaded();
  int u2=uploader2.amountUploaded();
  debug("String_Node_Str" + u1 + "String_Node_Str");
  debug("String_Node_Str" + u2 + "String_Node_Str");
  debug("String_Node_Str" + (u1 + u2) + "String_Node_Str");
  check(u1 < 9 * TestFile.length() / 10 + FUDGE_FACTOR * 10,"String_Node_Str");
  check(u2 < TestFile.length() / 10 + FUDGE_FACTOR,"String_Node_Str");
}
Program: 4738
Project: 4738
Buggy source:
private static void tUpdateWhiteWithFailingFirstUploader(){
  debug("String_Node_Str");
  final int RATE=500;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setRate(RATE);
  uploader1.setBusy(true);
  uploader2.setRate(RATE / 4);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100);
  RemoteFileDesc rfd2=newRFDWithURN(6347,100);
  RemoteFileDesc[] rfds={rfd1,rfd2};
  tGeneric(rfds);
  int u1=uploader1.amountUploaded();
  int u2=uploader2.amountUploaded();
  debug("String_Node_Str" + u1 + "String_Node_Str");
  debug("String_Node_Str" + u2 + "String_Node_Str");
  debug("String_Node_Str" + (u1 + u2) + "String_Node_Str");
  debug("String_Node_Str");
}

Fixed version (ground truth):
private static void tUpdateWhiteWithFailingFirstUploader(){
  debug("String_Node_Str");
  final int RATE=500;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setRate(RATE);
  uploader1.setBusy(true);
  uploader2.setRate(RATE / 4);
  RemoteFileDesc rfd1=newRFD(6346,100);
  RemoteFileDesc rfd2=newRFD(6347,100);
  RemoteFileDesc[] rfds={rfd1,rfd2};
  tGeneric(rfds);
  int u1=uploader1.amountUploaded();
  int u2=uploader2.amountUploaded();
  debug("String_Node_Str" + u1 + "String_Node_Str");
  debug("String_Node_Str" + u2 + "String_Node_Str");
  debug("String_Node_Str" + (u1 + u2) + "String_Node_Str");
  debug("String_Node_Str");
}
Program: 4739
Project: 4739
Buggy source:
private static void tQueuedDownloader(){
  debug("String_Node_Str");
  uploader1.setQueue(true);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100);
  RemoteFileDesc[] rfds={rfd1};
  tGeneric(rfds);
}

Fixed version (ground truth):
private static void tQueuedDownloader(){
  debug("String_Node_Str");
  uploader1.setQueue(true);
  RemoteFileDesc rfd1=newRFD(6346,100);
  RemoteFileDesc[] rfds={rfd1};
  tGeneric(rfds);
}
Program: 4740
Project: 4740
Buggy source:
private static void tSwarmWithInterrupt(){
  debug("String_Node_Str");
  final int RATE=500;
  final int STOP_AFTER=TestFile.length() / 4;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setRate(RATE);
  uploader2.setRate(RATE);
  uploader2.stopAfter(STOP_AFTER);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100);
  RemoteFileDesc rfd2=newRFDWithURN(6347,100);
  RemoteFileDesc[] rfds={rfd1,rfd2};
  tGeneric(rfds);
  int u1=uploader1.amountUploaded();
  int u2=uploader2.amountUploaded();
  debug("String_Node_Str" + u1 + "String_Node_Str");
  debug("String_Node_Str" + u2 + "String_Node_Str");
  debug("String_Node_Str" + (u1 + u2) + "String_Node_Str");
  check(u1 < TestFile.length() - STOP_AFTER + FUDGE_FACTOR,"String_Node_Str");
  check(u2 == STOP_AFTER,"String_Node_Str" + u2 + "String_Node_Str");
}

Fixed version (ground truth):
private static void tSwarmWithInterrupt(){
  debug("String_Node_Str");
  final int RATE=500;
  final int STOP_AFTER=TestFile.length() / 4;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setRate(RATE);
  uploader2.setRate(RATE);
  uploader2.stopAfter(STOP_AFTER);
  RemoteFileDesc rfd1=newRFD(6346,100);
  RemoteFileDesc rfd2=newRFD(6347,100);
  RemoteFileDesc[] rfds={rfd1,rfd2};
  tGeneric(rfds);
  int u1=uploader1.amountUploaded();
  int u2=uploader2.amountUploaded();
  debug("String_Node_Str" + u1 + "String_Node_Str");
  debug("String_Node_Str" + u2 + "String_Node_Str");
  debug("String_Node_Str" + (u1 + u2) + "String_Node_Str");
  check(u1 < TestFile.length() - STOP_AFTER + FUDGE_FACTOR,"String_Node_Str");
  check(u2 == STOP_AFTER,"String_Node_Str" + u2 + "String_Node_Str");
}
Program: 4741
Project: 4741
Buggy source:
private static void tMismatchedVerifyHash(boolean deleteCorrupt){
  debug("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + deleteCorrupt + "String_Node_Str");
  final int RATE=100;
  uploader1.setRate(RATE);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100,null);
  Downloader download=null;
  try {
    download=dm.download(new RemoteFileDesc[]{rfd1},false);
  }
 catch (  FileExistsException e) {
    check(false,"String_Node_Str");
    return;
  }
catch (  AlreadyDownloadingException e) {
    check(false,"String_Node_Str");
    return;
  }
catch (  java.io.FileNotFoundException e) {
    check(false,"String_Node_Str");
    return;
  }
  if (deleteCorrupt)   waitForCorrupt(download);
 else   waitForComplete(download);
  debug("String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
private static void tMismatchedVerifyHash(boolean deleteCorrupt){
  debug("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + deleteCorrupt + "String_Node_Str");
  final int RATE=100;
  uploader1.setRate(RATE);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100,"String_Node_Str");
  Downloader download=null;
  try {
    download=dm.download(new RemoteFileDesc[]{rfd1},false);
  }
 catch (  FileExistsException e) {
    check(false,"String_Node_Str");
    return;
  }
catch (  AlreadyDownloadingException e) {
    check(false,"String_Node_Str");
    return;
  }
catch (  java.io.FileNotFoundException e) {
    check(false,"String_Node_Str");
    return;
  }
  if (deleteCorrupt)   waitForCorrupt(download);
 else   waitForComplete(download);
  debug("String_Node_Str" + "String_Node_Str");
}
Program: 4742
Project: 4742
Buggy source:
private static void tSimpleDownload(){
  debug("String_Node_Str");
  RemoteFileDesc rfd=newRFDWithURN(6346,100);
  RemoteFileDesc[] rfds={rfd};
  tGeneric(rfds);
}

Fixed version (ground truth):
private static void tSimpleDownload(){
  debug("String_Node_Str");
  RemoteFileDesc rfd=newRFD(6346,100);
  RemoteFileDesc[] rfds={rfd};
  tGeneric(rfds);
}
Program: 4743
Project: 4743
Buggy source:
private static void tStealerInterrupted(){
  debug("String_Node_Str");
  final int RATE=500;
  final int STOP_AFTER=5 * TestFile.length() / 8;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setRate(RATE / 10);
  uploader2.setRate(RATE);
  uploader2.stopAfter(STOP_AFTER);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100);
  RemoteFileDesc rfd2=newRFDWithURN(6347,100);
  RemoteFileDesc[] rfds={rfd1,rfd2};
  tGeneric(rfds);
  int u1=uploader1.amountUploaded();
  int u2=uploader2.amountUploaded();
  debug("String_Node_Str" + u1 + "String_Node_Str");
  debug("String_Node_Str" + u2 + "String_Node_Str");
  debug("String_Node_Str" + (u1 + u2) + "String_Node_Str");
  check(u1 < TestFile.length() - STOP_AFTER + 2 * FUDGE_FACTOR,"String_Node_Str");
  check(u2 == STOP_AFTER,"String_Node_Str");
}

Fixed version (ground truth):
private static void tStealerInterrupted(){
  debug("String_Node_Str");
  final int RATE=500;
  final int STOP_AFTER=5 * TestFile.length() / 8;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setRate(RATE / 10);
  uploader2.setRate(RATE);
  uploader2.stopAfter(STOP_AFTER);
  RemoteFileDesc rfd1=newRFD(6346,100);
  RemoteFileDesc rfd2=newRFD(6347,100);
  RemoteFileDesc[] rfds={rfd1,rfd2};
  tGeneric(rfds);
  int u1=uploader1.amountUploaded();
  int u2=uploader2.amountUploaded();
  debug("String_Node_Str" + u1 + "String_Node_Str");
  debug("String_Node_Str" + u2 + "String_Node_Str");
  debug("String_Node_Str" + (u1 + u2) + "String_Node_Str");
  check(u1 < TestFile.length() - STOP_AFTER + 2 * FUDGE_FACTOR,"String_Node_Str");
  check(u2 == STOP_AFTER,"String_Node_Str");
}