Program: 4788
Project: 4788
Buggy source:
/** 
 * Makes sure that if downloaders reconnect too soon they are dropped also if uploaders respond too late they should be dropped. Downloader MUST respond bewteen MIN_POLL_TIME and MAX_POLL_TIME
 */
public void testQueueTiming(){
  UploadManager upManager=new UploadManager();
  SettingsManager.instance().setMaxUploads(2);
  SettingsManager.instance().setSoftMaxUploads(9999);
  SettingsManager.instance().setUploadsPerPerson(99999);
  SettingsManager.instance().setUploadQueueSize(2);
  HTTPDownloader d3=null;
  try {
    HTTPDownloader d1=addUploader(upManager,rfd1,"String_Node_Str",true);
    connectDloader(d1,true,rfd1,true);
    HTTPDownloader d2=addUploader(upManager,rfd2,"String_Node_Str",true);
    connectDloader(d2,true,rfd2,true);
    try {
      d3=addUploader(upManager,rfd3,"String_Node_Str",true);
      connectDloader(d3,true,rfd3,true);
      fail("String_Node_Str");
    }
 catch (    QueuedException qx) {
      assertEquals(1,qx.getQueuePosition());
    }
catch (    Exception ioe) {
      ioe.printStackTrace();
      fail("String_Node_Str");
    }
    HTTPDownloader d4=null;
    try {
      d4=addUploader(upManager,rfd4,"String_Node_Str",true);
      connectDloader(d4,true,rfd4,true);
      fail("String_Node_Str");
    }
 catch (    QueuedException qx) {
      assertEquals(2,qx.getQueuePosition());
    }
catch (    Exception ioe) {
      fail("String_Node_Str");
    }
    try {
      connectDloader(d3,false,rfd3,true);
      fail("String_Node_Str");
    }
 catch (    QueuedException qx) {
      fail("String_Node_Str");
    }
catch (    IOException ioe) {
    }
catch (    Exception e) {
      e.printStackTrace();
      fail("String_Node_Str");
    }
    System.out.println("String_Node_Str");
  }
 catch (  Exception anyother) {
    System.out.println("String_Node_Str");
    anyother.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Makes sure that if downloaders reconnect too soon they are dropped also if uploaders respond too late they should be dropped. Downloader MUST respond bewteen MIN_POLL_TIME and MAX_POLL_TIME
 */
public void testQueueTiming(){
  UploadManager upManager=new UploadManager();
  setUploadManager(upManager);
  SettingsManager.instance().setMaxUploads(2);
  SettingsManager.instance().setSoftMaxUploads(9999);
  SettingsManager.instance().setUploadsPerPerson(99999);
  SettingsManager.instance().setUploadQueueSize(2);
  HTTPDownloader d3=null;
  try {
    HTTPDownloader d1=addUploader(upManager,rfd1,"String_Node_Str",true);
    connectDloader(d1,true,rfd1,true);
    HTTPDownloader d2=addUploader(upManager,rfd2,"String_Node_Str",true);
    connectDloader(d2,true,rfd2,true);
    try {
      d3=addUploader(upManager,rfd3,"String_Node_Str",true);
      connectDloader(d3,true,rfd3,true);
      fail("String_Node_Str");
    }
 catch (    QueuedException qx) {
      assertEquals(1,qx.getQueuePosition());
    }
catch (    Exception ioe) {
      ioe.printStackTrace();
      fail("String_Node_Str");
    }
    HTTPDownloader d4=null;
    try {
      d4=addUploader(upManager,rfd4,"String_Node_Str",true);
      connectDloader(d4,true,rfd4,true);
      fail("String_Node_Str");
    }
 catch (    QueuedException qx) {
      assertEquals(2,qx.getQueuePosition());
    }
catch (    Exception ioe) {
      fail("String_Node_Str");
    }
    try {
      connectDloader(d3,false,rfd3,true);
      fail("String_Node_Str");
    }
 catch (    QueuedException qx) {
      fail("String_Node_Str");
    }
catch (    IOException ioe) {
    }
catch (    Exception e) {
      e.printStackTrace();
      fail("String_Node_Str");
    }
    System.out.println("String_Node_Str");
  }
 catch (  Exception anyother) {
    System.out.println("String_Node_Str");
    anyother.printStackTrace();
  }
}