Program: 4231
Project: 4231
Buggy source:
public void testGreedyLimitReached() throws Exception {
  UploadSettings.HARD_MAX_UPLOADS.setValue(2);
  UploadSettings.SOFT_MAX_UPLOADS.setValue(9999);
  UploadSettings.UPLOADS_PER_PERSON.setValue(2);
  UploadSettings.UPLOAD_QUEUE_SIZE.setValue(10);
  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,rfd1,true);
  HTTPDownloader d3=addUploader(upManager,rfd3,"String_Node_Str",true);
  try {
    connectDloader(d3,true,rfd1,true);
    fail("String_Node_Str");
  }
 catch (  QueuedException qx) {
    fail("String_Node_Str",qx);
  }
catch (  TryAgainLaterException expectedException) {
  }
catch (  IOException ioe) {
  }
  HTTPDownloader d4=addUploader(upManager,rfd4,"String_Node_Str",true);
  try {
    connectDloader(d4,true,rfd1,true);
    fail("String_Node_Str");
  }
 catch (  TryAgainLaterException tx) {
    fail("String_Node_Str",tx);
  }
catch (  QueuedException expectedException) {
  }
catch (  IOException ioe) {
    fail("String_Node_Str",ioe);
  }
  assertEquals("String_Node_Str",1,upManager.getNumQueuedUploads());
  assertEquals("String_Node_Str",2,upManager.uploadsInProgress());
  kill(d1);
  kill(d2);
  assertEquals("String_Node_Str",1,upManager.getNumQueuedUploads());
  assertEquals("String_Node_Str",0,upManager.uploadsInProgress());
  try {
    d3=addUploader(upManager,rfd3,"String_Node_Str",true);
    connectDloader(d3,true,rfd1,true);
    fail("String_Node_Str");
  }
 catch (  QueuedException qx) {
    fail("String_Node_Str",qx);
  }
catch (  TryAgainLaterException expectedException) {
  }
catch (  IOException ioe) {
  }
  assertEquals("String_Node_Str",1,upManager.getNumQueuedUploads());
  assertEquals("String_Node_Str",0,upManager.uploadsInProgress());
}

Fixed version (ground truth):
public void testGreedyLimitReached() throws Exception {
  UploadSettings.HARD_MAX_UPLOADS.setValue(2);
  UploadSettings.SOFT_MAX_UPLOADS.setValue(9999);
  UploadSettings.UPLOADS_PER_PERSON.setValue(1);
  UploadSettings.UPLOAD_QUEUE_SIZE.setValue(10);
  HTTPDownloader d1=addUploader(upManager,rfd1,"String_Node_Str",true);
  connectDloader(d1,true,rfd1,true);
  HTTPDownloader d2=addUploader(upManager,rfd2,"String_Node_Str",true);
  try {
    connectDloader(d2,true,rfd2,true);
    fail("String_Node_Str");
  }
 catch (  QueuedException qx) {
    fail("String_Node_Str",qx);
  }
catch (  TryAgainLaterException expectedException) {
  }
catch (  IOException ioe) {
  }
  HTTPDownloader d3=addUploader(upManager,rfd3,"String_Node_Str",true);
  connectDloader(d3,true,rfd3,true);
  HTTPDownloader d4=addUploader(upManager,rfd4,"String_Node_Str",true);
  try {
    connectDloader(d4,true,rfd4,true);
    fail("String_Node_Str");
  }
 catch (  TryAgainLaterException expected) {
  }
catch (  QueuedException que) {
    fail("String_Node_Str",que);
  }
catch (  IOException ioe) {
    fail("String_Node_Str",ioe);
  }
  HTTPDownloader d5=addUploader(upManager,rfd5,"String_Node_Str",true);
  try {
    connectDloader(d5,true,rfd5,true);
    fail("String_Node_Str");
  }
 catch (  QueuedException expected) {
  }
  assertEquals("String_Node_Str",1,upManager.getNumQueuedUploads());
  assertEquals("String_Node_Str",2,upManager.uploadsInProgress());
  kill(d1);
  kill(d3);
  assertEquals("String_Node_Str",1,upManager.getNumQueuedUploads());
  assertEquals("String_Node_Str",0,upManager.uploadsInProgress());
  try {
    d2=addUploader(upManager,rfd2,"String_Node_Str",true);
    connectDloader(d2,true,rfd2,true);
    fail("String_Node_Str");
  }
 catch (  QueuedException qx) {
    fail("String_Node_Str",qx);
  }
catch (  TryAgainLaterException expectedException) {
  }
catch (  IOException ioe) {
  }
  assertEquals("String_Node_Str",1,upManager.getNumQueuedUploads());
  assertEquals("String_Node_Str",0,upManager.uploadsInProgress());
}