nus-yam/ex-repair huggingface dataset:
Program: 4744
Project: 4744
Buggy source:
private static void tOverlapCheckWhite(boolean deleteCorrupt){
  debug("String_Node_Str" + "String_Node_Str" + deleteCorrupt + "String_Node_Str");
  final int RATE=500;
  uploader1.setCorruption(true);
  uploader1.stopAfter(TestFile.length() / 8);
  uploader2.setRate(RATE);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100);
  RemoteFileDesc rfd2=newRFDWithURN(6347,100);
  Downloader download=null;
  try {
    download=dm.download(new RemoteFileDesc[]{rfd1,rfd2},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 tOverlapCheckWhite(boolean deleteCorrupt){
  debug("String_Node_Str" + "String_Node_Str" + deleteCorrupt + "String_Node_Str");
  final int RATE=500;
  uploader1.setCorruption(true);
  uploader1.stopAfter(TestFile.length() / 8);
  uploader2.setRate(RATE);
  RemoteFileDesc rfd1=newRFD(6346,100);
  RemoteFileDesc rfd2=newRFD(6347,100);
  Downloader download=null;
  try {
    download=dm.download(new RemoteFileDesc[]{rfd1,rfd2},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: 4745
Project: 4745
Buggy source:
private static void tStallingUploaderReplaced(){
  debug("String_Node_Str");
  final int RATE=500;
  uploader1.setRate(0);
  uploader2.setRate(RATE);
  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" + "String_Node_Str");
}

Fixed version (ground truth):
private static void tStallingUploaderReplaced(){
  debug("String_Node_Str");
  final int RATE=500;
  uploader1.setRate(0);
  uploader2.setRate(RATE);
  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" + "String_Node_Str");
}
Program: 4746
Project: 4746
Buggy source:
private static void tOverlapCheckGrey(boolean deleteCorrupt){
  debug("String_Node_Str" + "String_Node_Str" + deleteCorrupt + "String_Node_Str");
  final int RATE=500;
  uploader1.setRate(RATE);
  uploader2.setRate(RATE / 100);
  uploader2.setCorruption(true);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100);
  RemoteFileDesc rfd2=newRFDWithURN(6347,100);
  Downloader download=null;
  try {
    download=dm.download(new RemoteFileDesc[]{rfd1,rfd2},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 tOverlapCheckGrey(boolean deleteCorrupt){
  debug("String_Node_Str" + "String_Node_Str" + deleteCorrupt + "String_Node_Str");
  final int RATE=500;
  uploader1.setRate(RATE);
  uploader2.setRate(RATE / 100);
  uploader2.setCorruption(true);
  RemoteFileDesc rfd1=newRFD(6346,100);
  RemoteFileDesc rfd2=newRFD(6347,100);
  Downloader download=null;
  try {
    download=dm.download(new RemoteFileDesc[]{rfd1,rfd2},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: 4747
Project: 4747
Buggy source:
private static void tAlternateLocationsExchangedWithBusy(){
  debug("String_Node_Str");
  final int RATE=500;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setBusy(true);
  uploader2.setRate(RATE);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100,testHash.toString());
  RemoteFileDesc rfd2=newRFDWithURN(6347,100,testHash.toString());
  RemoteFileDesc[] rfds={rfd1};
  AlternateLocationCollection ualt=AlternateLocationCollection.createCollection(rfd1.getSHA1Urn());
  try {
    URL url2=rfd2.getUrl();
    AlternateLocation al2=AlternateLocation.createAlternateLocation(url2);
    ualt.addAlternateLocation(al2);
  }
 catch (  Exception e) {
    check(false,"String_Node_Str");
  }
  uploader1.setAlternateLocations(ualt);
  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 == 0,"String_Node_Str");
  check(u2 < TestFile.length() + FUDGE_FACTOR,"String_Node_Str");
}

Fixed version (ground truth):
private static void tAlternateLocationsExchangedWithBusy(){
  debug("String_Node_Str");
  final int RATE=500;
  final int FUDGE_FACTOR=RATE * 1024;
  uploader1.setBusy(true);
  uploader2.setRate(RATE);
  RemoteFileDesc rfd1=newRFDWithURN(6346,100);
  RemoteFileDesc rfd2=newRFDWithURN(6347,100);
  RemoteFileDesc[] rfds={rfd1};
  AlternateLocationCollection ualt=AlternateLocationCollection.createCollection(rfd1.getSHA1Urn());
  try {
    URL url2=rfd2.getUrl();
    AlternateLocation al2=AlternateLocation.createAlternateLocation(url2);
    ualt.addAlternateLocation(al2);
  }
 catch (  Exception e) {
    check(false,"String_Node_Str");
  }
  uploader1.setAlternateLocations(ualt);
  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 == 0,"String_Node_Str");
  check(u2 < TestFile.length() + FUDGE_FACTOR,"String_Node_Str");
}
Program: 4748
Project: 4748
Buggy source:
private static void tSimpleSwarm(){
  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);
  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() / 2 + FUDGE_FACTOR,"String_Node_Str");
  check(u2 < TestFile.length() / 2 + FUDGE_FACTOR,"String_Node_Str");
}

Fixed version (ground truth):
private static void tSimpleSwarm(){
  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);
  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() / 2 + FUDGE_FACTOR,"String_Node_Str");
  check(u2 < TestFile.length() / 2 + FUDGE_FACTOR,"String_Node_Str");
}
Program: 4750
Project: 4750
Buggy source:
/** 
 * Checks if the <tt>QueryReply</tt> should be dropped based on per-TTL hard limits for the number of bytes routed for the given reply guid. This algorithm favors replies that don't have as far to go on the  network -- i.e., low TTL hits have more liberal limits than high TTL hits.  This ensures that hits that are closer to the query originator -- hits for which we've already done most of the work, are not  dropped unless we've routed a really large number of bytes for that guid.
 */
private static boolean shouldDropReply(int bytesRouted,int ttl){
  if (ttl > 3 && bytesRouted < 50 * 1024)   return true;
  if (ttl == 0 && bytesRouted < 50 * 1024)   return true;
  if (ttl == 1 && bytesRouted < 1000 * 1024)   return true;
  if (ttl == 2 && bytesRouted < 333 * 1024)   return true;
  if (ttl == 3 && bytesRouted < 111 * 1024)   return true;
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if the <tt>QueryReply</tt> should be dropped based on per-TTL hard limits for the number of bytes routed for the given reply guid. This algorithm favors replies that don't have as far to go on the  network -- i.e., low TTL hits have more liberal limits than high TTL hits.  This ensures that hits that are closer to the query originator -- hits for which we've already done most of the work, are not  dropped unless we've routed a really large number of bytes for that guid.
 */
private static boolean shouldDropReply(int bytesRouted,int ttl){
  if (ttl > 3 && bytesRouted < 50 * 1024)   return false;
  if (ttl == 0 && bytesRouted < 50 * 1024)   return false;
  if (ttl == 1 && bytesRouted < 1000 * 1024)   return false;
  if (ttl == 2 && bytesRouted < 333 * 1024)   return false;
  if (ttl == 3 && bytesRouted < 111 * 1024)   return false;
  return true;
}
Program: 4751
Project: 4751
Buggy source:
/** 
 * Tests the constructor that takes a URL and a URN as arguments.
 */
public void testUrlUrnConstructor(){
  try {
    for (int i=0; i < HugeTestUtils.URNS.length; i++) {
      URN urn=URN.createSHA1Urn(HugeTestUtils.VALID_URN_STRINGS[i]);
      URL url1=new URL("String_Node_Str",HugeTestUtils.URL_STRINGS[i],6346,"String_Node_Str" + HugeTestUtils.URNS[i].httpStringValue());
      URL url2=new URL("String_Node_Str",HugeTestUtils.URL_STRINGS[i],"String_Node_Str");
      AlternateLocation al1=AlternateLocation.createAlternateLocation(url1);
      AlternateLocation al2=AlternateLocation.createAlternateLocation(url2);
    }
  }
 catch (  IOException e) {
    fail("String_Node_Str" + "String_Node_Str" + e);
  }
}

Fixed version (ground truth):
/** 
 * Tests the constructor that takes a URL and a URN as arguments.
 */
public void testUrlUrnConstructor(){
  try {
    for (int i=0; i < HugeTestUtils.URNS.length; i++) {
      URN urn=URN.createSHA1Urn(HugeTestUtils.VALID_URN_STRINGS[i]);
      URL url1=new URL("String_Node_Str",HugeTestUtils.URL_STRINGS[i],6346,"String_Node_Str" + HugeTestUtils.URNS[i].httpStringValue());
      URL url2=new URL("String_Node_Str",HugeTestUtils.URL_STRINGS[i],6346,"String_Node_Str");
      AlternateLocation al1=AlternateLocation.createAlternateLocation(url1);
      AlternateLocation al2=AlternateLocation.createAlternateLocation(url2);
    }
  }
 catch (  IOException e) {
    fail("String_Node_Str" + "String_Node_Str" + e);
  }
}
Program: 4752
Project: 4752
Buggy source:
/** 
 * Tests invalid alternate location strings to make sure they fail.
 */
public void testStringConstructorForInvalidLocs(){
  try {
    for (int i=0; i < HugeTestUtils.INVALID_LOCS.length; i++) {
      AlternateLocation al=AlternateLocation.createAlternateLocation(HugeTestUtils.INVALID_LOCS[i]);
      assertTrue("String_Node_Str",false);
    }
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
/** 
 * Tests invalid alternate location strings to make sure they fail.
 */
public void testStringConstructorForInvalidLocs(){
  try {
    for (int i=0; i < HugeTestUtils.INVALID_LOCS.length; i++) {
      AlternateLocation al=AlternateLocation.createAlternateLocation(HugeTestUtils.INVALID_LOCS[i]);
      fail("String_Node_Str");
    }
  }
 catch (  IOException e) {
  }
}
Program: 4753
Project: 4753
Buggy source:
/** 
 * Reloads the settings with the specified settings file from disk.
 * @param settingsStream the <tt>InputStream</tt> to load
 */
public void reload(File file){
  try {
    PROPS.load(new FileInputStream(file));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Reloads the settings with the specified settings file from disk.
 * @param settingsStream the <tt>InputStream</tt> to load
 */
public void reload(File file){
  if (!file.isFile())   return;
  try {
    PROPS.load(new FileInputStream(file));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 4754
Project: 4754
Buggy source:
/** 
 * Test the method for copying files from jars to disk.
 */
public void testCommonUtilsCopyResourceFile(){
  File newResourceFile=new File("String_Node_Str","String_Node_Str");
  newResourceFile.deleteOnExit();
  String fileName="String_Node_Str";
  try {
    JarFile collections=new JarFile(new File("String_Node_Str","String_Node_Str"));
    JarEntry entry=collections.getJarEntry(fileName);
    long entrySize=entry.getCompressedSize();
    CommonUtils.copyResourceFile(fileName,newResourceFile);
    assertEquals("String_Node_Str",entrySize,newResourceFile.length());
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e);
  }
  newResourceFile.delete();
  new File("String_Node_Str").delete();
}

Fixed version (ground truth):
/** 
 * Test the method for copying files from jars to disk.
 */
public void testCommonUtilsCopyResourceFile(){
  File newResourceFile=new File("String_Node_Str","String_Node_Str");
  newResourceFile.deleteOnExit();
  String fileName="String_Node_Str";
  try {
    JarFile collections=new JarFile(new File("String_Node_Str","String_Node_Str"));
    JarEntry entry=collections.getJarEntry(fileName);
    long entrySize=entry.getCompressedSize();
    CommonUtils.copyResourceFile(fileName,newResourceFile,false);
    assertEquals("String_Node_Str",entrySize,newResourceFile.length());
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e);
  }
  newResourceFile.delete();
  new File("String_Node_Str").delete();
}
Program: 4755
Project: 4755
Buggy source:
/** 
 * This method will be called just once from RouterService at startup and it should prompt the user if there is an update message.
 */
public void postGuiInit(ActivityCallback gui){
  String myVersion=CommonUtils.getLimeWireVersion();
  if (isGreaterVersion(myVersion,latestVersion))   return;
  String guiMessage=latestVersion + "String_Node_Str" + message;
  gui.notifyUserAboutUpdate(guiMessage,CommonUtils.isPro(),usesLocale);
}

Fixed version (ground truth):
/** 
 * This method will be called just once from RouterService at startup and it should prompt the user if there is an update message.
 */
public void postGuiInit(ActivityCallback gui){
  String myVersion=CommonUtils.getLimeWireVersion();
  if (myVersion.equalsIgnoreCase(latestVersion))   return;
  if (isGreaterVersion(myVersion,latestVersion))   return;
  String guiMessage=latestVersion + "String_Node_Str" + message;
  gui.notifyUserAboutUpdate(guiMessage,CommonUtils.isPro(),usesLocale);
}
Program: 4756
Project: 4756
Buggy source:
/** 
 * writes data to signed_updateFile
 */
private void commitVersionFile(byte[] data) throws IOException {
  File f=new File(CommonUtils.getUserSettingsDir(),"String_Node_Str");
  File nf=new File(CommonUtils.getUserSettingsDir(),"String_Node_Str");
  RandomAccessFile raf=new RandomAccessFile(nf,"String_Node_Str");
  raf.write(data);
  boolean deleted=nf.renameTo(f);
  if (!deleted)   throw new IOException();
}

Fixed version (ground truth):
/** 
 * writes data to signed_updateFile
 */
private void commitVersionFile(byte[] data) throws IOException {
  File f=new File(CommonUtils.getUserSettingsDir(),"String_Node_Str");
  File nf=new File(CommonUtils.getUserSettingsDir(),"String_Node_Str");
  RandomAccessFile raf=new RandomAccessFile(nf,"String_Node_Str");
  raf.write(data);
  raf.close();
  boolean deleteOld=f.delete();
  if (deleteOld) {
    boolean renamed=nf.renameTo(f);
    if (!renamed) {
      nf.delete();
      throw new IOException();
    }
  }
 else {
    nf.delete();
    throw new IOException();
  }
}
Program: 4759
Project: 4759
Buggy source:
public Integer[] getStatHistory(){
  _statHistory=(Integer[])STAT_HISTORY.toArray(new Integer[0]);
  return _statHistory;
}

Fixed version (ground truth):
public Integer[] getStatHistory(){
synchronized (STAT_HISTORY) {
    _statHistory=(Integer[])STAT_HISTORY.toArray(new Integer[0]);
  }
  return _statHistory;
}
Program: 4760
Project: 4760
Buggy source:
public void storeCurrentStat(){
  STAT_HISTORY.remove(0);
  STAT_HISTORY.add(new Integer(_current));
  if (_current > _max) {
    _max=_current;
  }
  if (_writeStat) {
    if (_writer != null) {
      try {
        _writer.write(Integer.toString(_current));
        _writer.write("String_Node_Str");
        _writer.flush();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  _current=0;
  _totalStatsRecorded++;
}

Fixed version (ground truth):
public void storeCurrentStat(){
synchronized (STAT_HISTORY) {
    STAT_HISTORY.remove(0);
    STAT_HISTORY.add(new Integer(_current));
  }
  if (_current > _max) {
    _max=_current;
  }
  if (_writeStat) {
    if (_writer != null) {
      try {
        _writer.write(Integer.toString(_current));
        _writer.write("String_Node_Str");
        _writer.flush();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  _current=0;
  _totalStatsRecorded++;
}
Program: 4761
Project: 4761
Buggy source:
/** 
 * Returns the version of the GUESS search scheme supported by the node at the other end of the connection.  This returns the version in whole numbers.  So, if the supported GUESS version is 0.1, this  will return 1.  If the other client has not sent an X-Guess header this returns -1.
 * @return the version of GUESS supported, reported as a whole number,or -1 if GUESS is not supported
 */
public int getGUESSVersion(){
  String value=super.getProperty(ConnectionHandshakeHeaders.X_GUESS);
  if (value == null)   return -1;
 else {
    float version=Float.parseFloat(value);
    version*=10;
    return (int)version;
  }
}

Fixed version (ground truth):
/** 
 * Returns the version of the GUESS search scheme supported by the node at the other end of the connection.  This returns the version in whole numbers.  So, if the supported GUESS version is 0.1, this  will return 1.  If the other client has not sent an X-Guess header this returns -1.
 * @return the version of GUESS supported, reported as a whole number,or -1 if GUESS is not supported
 */
public int getGUESSVersion(){
  String value=super.getProperty(ConnectionHandshakeHeaders.X_GUESS);
  if (value == null)   return -1;
 else {
    float version=Float.valueOf(value).floatValue();
    version*=10;
    return (int)version;
  }
}
Program: 4762
Project: 4762
Buggy source:
private void handleRequest(Socket socket) throws IOException {
  BufferedReader input=new BufferedReader(new InputStreamReader(socket.getInputStream()));
  ThrottledOutputStream output=new ThrottledOutputStream(new BufferedOutputStream(socket.getOutputStream()),new BandwidthThrottle(rate * 1024));
  int start=0;
  int stop=TestFile.length();
  boolean firstLine=true;
  while (true) {
    String line=input.readLine();
    if (firstLine) {
      request=line;
      firstLine=false;
    }
    if (line == null)     throw new IOException("String_Node_Str");
    if (line.equals("String_Node_Str"))     break;
    if (HTTPHeaderName.ALT_LOCATION.matchesStartOfString(line)) {
      readAlternateLocations(line,incomingAltLocs);
    }
    if (HTTPHeaderName.CONTENT_URN.matchesStartOfString(line)) {
      sha1=readContentUrn(line);
    }
    int i=line.indexOf("String_Node_Str");
    Assert.that(i <= 0,"String_Node_Str");
    if (i == 0) {
      IntPair p=null;
      try {
        p=parseRange(line);
      }
 catch (      Exception e) {
        Assert.that(false,"String_Node_Str" + line + "String_Node_Str");
      }
      start=p.a;
      stop=p.b;
      ;
    }
    i=line.indexOf("String_Node_Str");
    if (i == 0)     http11=line.indexOf("String_Node_Str") > 0;
  }
  send(output,start,stop);
}

Fixed version (ground truth):
private void handleRequest(Socket socket) throws IOException {
  BufferedReader input=new BufferedReader(new InputStreamReader(socket.getInputStream()));
  ThrottledOutputStream output=new ThrottledOutputStream(new BufferedOutputStream(socket.getOutputStream()),new BandwidthThrottle(rate * 1024));
  int start=0;
  int stop=TestFile.length();
  boolean firstLine=true;
  while (true) {
    String line=input.readLine();
    if (firstLine) {
      request=line;
      firstLine=false;
    }
    if (line == null)     throw new IOException("String_Node_Str");
    if (line.equals("String_Node_Str"))     break;
    if (HTTPHeaderName.ALT_LOCATION.matchesStartOfString(line)) {
      readAlternateLocations(line,incomingAltLocs);
    }
    if (HTTPHeaderName.GNUTELLA_CONTENT_URN.matchesStartOfString(line)) {
      sha1=readContentUrn(line);
    }
    int i=line.indexOf("String_Node_Str");
    Assert.that(i <= 0,"String_Node_Str");
    if (i == 0) {
      IntPair p=null;
      try {
        p=parseRange(line);
      }
 catch (      Exception e) {
        Assert.that(false,"String_Node_Str" + line + "String_Node_Str");
      }
      start=p.a;
      stop=p.b;
      ;
    }
    i=line.indexOf("String_Node_Str");
    if (i == 0)     http11=line.indexOf("String_Node_Str") > 0;
  }
  send(output,start,stop);
}
Program: 4763
Project: 4763
Buggy source:
public void incrementStat(){
  QUERY_REPLY_ROUTE_ERRORS.incrementStat();
}

Fixed version (ground truth):
public void incrementStat(){
  super.incrementStat();
  QUERY_REPLY_ROUTE_ERRORS.incrementStat();
}
Program: 4764
Project: 4764
Buggy source:
/** 
 * @modifies this
 * @effects atomically removes and returns the highest priority host inthis.  If no host is available, blocks until one is.  If the calling thread is interrupted during this process, throws InterruptedException. The caller should call doneWithConnect and doneWithMessageLoop when done with the returned value.
 */
public synchronized Endpoint getAnEndpoint() throws InterruptedException {
  while (true) {
    if (getNumUltrapeerHosts() == 0)     gWebCache.fetchEndpointsAsync();
    try {
      return getAnEndpointInternal();
    }
 catch (    NoSuchElementException e) {
    }
    wait();
  }
}

Fixed version (ground truth):
/** 
 * @modifies this
 * @effects atomically removes and returns the highest priority host inthis.  If no host is available, blocks until one is.  If the calling thread is interrupted during this process, throws InterruptedException. The caller should call doneWithConnect and doneWithMessageLoop when done with the returned value.
 */
public synchronized Endpoint getAnEndpoint() throws InterruptedException {
  while (true) {
    if (getNumHosts() == 0) {
      gWebCache.fetchEndpointsAsync();
    }
 else     if (getNumUltrapeerHosts() == 0) {
      long now=System.currentTimeMillis();
      if (now < nextAllowedFetchTime) {
        nextAllowedFetchTime=Math.min(nextAllowedFetchTime,now + GWEBCACHE_DELAY);
      }
 else {
        gWebCache.fetchEndpointsAsync();
        nextAllowedFetchTime=Long.MAX_VALUE;
      }
    }
    try {
      return getAnEndpointInternal();
    }
 catch (    NoSuchElementException e) {
    }
    wait();
  }
}
Program: 4765
Project: 4765
Buggy source:
/** 
 * Notifies this that connect() has been called.  This may decide to give out bootstrap pongs if necessary.
 */
public synchronized void expire(){
  gWebCache.fetchBootstrapServersAsync();
  gWebCache.fetchEndpointsAsync();
}

Fixed version (ground truth):
/** 
 * Notifies this that connect() has been called.  This may decide to give out bootstrap pongs if necessary.
 */
public synchronized void expire(){
  gWebCache.fetchBootstrapServersAsync();
}
Program: 4766
Project: 4766
Buggy source:
/** 
 * Returns the directory where all user settings should be stored.  This is where all application data should be stored.  If the directory does does not already exist, this attempts to create the directory, although this is not guaranteed to succeed.
 * @return the <tt>File</tt> instance denoting the user's home directory for the application, or <tt>null</tt> if that directory  does not exist
 */
public static File getUserSettingsDir(){
  File settingsDir=null;
  if (CommonUtils.isWindows()) {
    settingsDir=CommonUtils.getCurrentDirectory();
  }
 else   if (CommonUtils.isMacOSX()) {
    File userPrefsDir;
    try {
      short userDomainCode=-32763;
      userPrefsDir=MRJFileUtils.findFolder(userDomainCode,new MRJOSType("String_Node_Str"));
      settingsDir=new File(userPrefsDir,"String_Node_Str");
    }
 catch (    FileNotFoundException e) {
    }
catch (    NoSuchMethodError e) {
      settingsDir=CommonUtils.getCurrentDirectory();
    }
  }
 else {
    settingsDir=new File(CommonUtils.getUserHomeDir(),"String_Node_Str");
  }
  if (settingsDir == null) {
    settingsDir=new File(CommonUtils.getUserHomeDir(),"String_Node_Str");
  }
  if (!settingsDir.isDirectory()) {
    settingsDir.mkdirs();
  }
  return settingsDir;
}

Fixed version (ground truth):
/** 
 * Returns the directory where all user settings should be stored.  This is where all application data should be stored.  If the directory does does not already exist, this attempts to create the directory, although this is not guaranteed to succeed.
 * @return the <tt>File</tt> instance denoting the user's home directory for the application, or <tt>null</tt> if that directory  does not exist
 */
public synchronized static File getUserSettingsDir(){
  File settingsDir=new File(getUserHomeDir(),LIMEWIRE_PREFS_DIR_NAME);
  if (CommonUtils.isMacOSX()) {
    File tempSettingsDir=new File(getUserHomeDir(),"String_Node_Str");
    settingsDir=new File(tempSettingsDir,"String_Node_Str");
  }
  if (!settingsDir.isDirectory()) {
    if (!settingsDir.mkdirs()) {
      String msg="String_Node_Str" + settingsDir;
      throw new RuntimeException(msg);
    }
  }
  moveWindowsFiles(settingsDir);
  return settingsDir;
}
Program: 4767
Project: 4767
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTest(BootstrapServerTest.suite());
  suite.addTest(BootstrapServerManagerTest.suite());
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTest(BootstrapServerTest.suite());
  suite.addTest(BootstrapServerManagerTest.suite());
  suite.addTest(HostCatcherFetchTest.suite());
  return suite;
}
Program: 4768
Project: 4768
Buggy source:
public void run(){
  Iterator keys=null;
  Set toRemove=new HashSet();
synchronized (_pushedHosts) {
    keys=_pushedHosts.keySet().iterator();
    while (keys.hasNext()) {
      Object currKey=keys.next();
      PushRequestDetails currPRD=null;
      currPRD=(PushRequestDetails)_pushedHosts.get(currKey);
      if ((currPRD != null) && (currPRD.isExpired())) {
        debug("String_Node_Str");
        toRemove.add(currKey);
        currPRD.bhh._callback.browseHostFailed(currPRD.bhh._guid);
      }
    }
    keys=toRemove.iterator();
    while (keys.hasNext())     _pushedHosts.remove(keys.next());
  }
}

Fixed version (ground truth):
public void run(){
  try {
    Iterator keys=null;
    Set toRemove=new HashSet();
synchronized (_pushedHosts) {
      keys=_pushedHosts.keySet().iterator();
      while (keys.hasNext()) {
        Object currKey=keys.next();
        PushRequestDetails currPRD=null;
        currPRD=(PushRequestDetails)_pushedHosts.get(currKey);
        if ((currPRD != null) && (currPRD.isExpired())) {
          debug("String_Node_Str");
          toRemove.add(currKey);
          currPRD.bhh._callback.browseHostFailed(currPRD.bhh._guid);
        }
      }
      keys=toRemove.iterator();
      while (keys.hasNext())       _pushedHosts.remove(keys.next());
    }
  }
 catch (  Throwable t) {
    RouterService.error(t);
  }
}
Program: 4769
Project: 4769
Buggy source:
public void run(){
  Endpoint endpoint=null;
  do {
    try {
      endpoint=_catcher.getAnEndpoint();
    }
 catch (    InterruptedException exc2) {
      return;
    }
  }
 while (isConnected(endpoint));
  Assert.that(endpoint != null);
  ManagedConnection connection=new ManagedConnection(endpoint.getHostname(),endpoint.getPort(),_router,ConnectionManager.this);
  try {
    try {
      initializeFetchedConnection(connection,this);
      _catcher.doneWithConnect(endpoint,true);
    }
 catch (    NoGnutellaOkException e) {
      _catcher.doneWithConnect(endpoint,true);
      throw e;
    }
catch (    IOException e) {
      _catcher.doneWithConnect(endpoint,false);
      throw e;
    }
    startConnection(connection);
  }
 catch (  IOException e) {
  }
catch (  Exception e) {
    RouterService.error(ActivityCallback.INTERNAL_ERROR,e);
  }
 finally {
    if (connection.isClientSupernodeConnection())     lostShieldedClientSupernodeConnection();
  }
}

Fixed version (ground truth):
public void run(){
  Endpoint endpoint=null;
  do {
    try {
      endpoint=_catcher.getAnEndpoint();
    }
 catch (    InterruptedException exc2) {
      return;
    }
  }
 while (isConnected(endpoint));
  Assert.that(endpoint != null);
  ManagedConnection connection=new ManagedConnection(endpoint.getHostname(),endpoint.getPort(),_router,ConnectionManager.this);
  try {
    try {
      initializeFetchedConnection(connection,this);
      _catcher.doneWithConnect(endpoint,true);
    }
 catch (    NoGnutellaOkException e) {
      _catcher.doneWithConnect(endpoint,true);
      throw e;
    }
catch (    IOException e) {
      _catcher.doneWithConnect(endpoint,false);
      throw e;
    }
    startConnection(connection);
  }
 catch (  IOException e) {
  }
catch (  Throwable e) {
    RouterService.error(ActivityCallback.INTERNAL_ERROR,e);
  }
 finally {
    if (connection.isClientSupernodeConnection())     lostShieldedClientSupernodeConnection();
  }
}
Program: 4770
Project: 4770
Buggy source:
/** 
 * Loop forever, replacing old dud connections with new good ones. 
 */
public void run(){
  while (true) {
    List duds=findDuds();
    if (duds.size() > 0) {
      killIfStillDud(duds);
    }
  }
}

Fixed version (ground truth):
/** 
 * Loop forever, replacing old dud connections with new good ones. 
 */
public void run(){
  try {
    while (true) {
      List duds=findDuds();
      if (duds.size() > 0) {
        killIfStillDud(duds);
      }
    }
  }
 catch (  Throwable t) {
    RouterService.error(t);
  }
}
Program: 4771
Project: 4771
Buggy source:
public void run(){
  if (downloadsInProgress() > 0)   writeSnapshot();
}

Fixed version (ground truth):
public void run(){
  try {
    if (downloadsInProgress() > 0)     writeSnapshot();
  }
 catch (  Throwable t) {
    RouterService.error(t);
  }
}
Program: 4772
Project: 4772
Buggy source:
/** 
 * Performs the slow, low-priority initialization tasks: reading in snapshots and scheduling snapshot checkpointing.
 */
public void postGuiInit(){
  readSnapshot(SettingsManager.instance().getDownloadSnapshotFile());
  Runnable checkpointer=new Runnable(){
    public void run(){
      if (downloadsInProgress() > 0)       writeSnapshot();
    }
  }
;
  RouterService.schedule(checkpointer,SNAPSHOT_CHECKPOINT_TIME,SNAPSHOT_CHECKPOINT_TIME);
}

Fixed version (ground truth):
/** 
 * Performs the slow, low-priority initialization tasks: reading in snapshots and scheduling snapshot checkpointing.
 */
public void postGuiInit(){
  readSnapshot(SettingsManager.instance().getDownloadSnapshotFile());
  Runnable checkpointer=new Runnable(){
    public void run(){
      try {
        if (downloadsInProgress() > 0)         writeSnapshot();
      }
 catch (      Throwable t) {
        RouterService.error(t);
      }
    }
  }
;
  RouterService.schedule(checkpointer,SNAPSHOT_CHECKPOINT_TIME,SNAPSHOT_CHECKPOINT_TIME);
}
Program: 4773
Project: 4773
Buggy source:
public void run(){
  try {
    loadSettingsBlocking(notifyOnClearFinal);
  }
 catch (  Exception e) {
    _callback.error(e);
  }
}

Fixed version (ground truth):
public void run(){
  try {
    loadSettingsBlocking(notifyOnClearFinal);
  }
 catch (  Throwable t) {
    _callback.error(t);
  }
}
Program: 4775
Project: 4775
Buggy source:
public void run(){
  if (RouterService.acceptedIncomingConnection() && RouterService.isSupernode()) {
    Endpoint e=new Endpoint(RouterService.getAddress(),RouterService.getPort());
    gWebCache.sendUpdatesAsync(e);
  }
}

Fixed version (ground truth):
public void run(){
  try {
    if (RouterService.acceptedIncomingConnection() && RouterService.isSupernode()) {
      Endpoint e=new Endpoint(RouterService.getAddress(),RouterService.getPort());
      gWebCache.sendUpdatesAsync(e);
    }
  }
 catch (  Throwable t) {
    RouterService.error(t);
  }
}
Program: 4776
Project: 4776
Buggy source:
/** 
 * Links the HostCatcher up with the other back end pieces, and, if quick connect is not specified in the SettingsManager, loads the hosts in the host list into the maybe set.  (The likelys set is empty.)  If filename does not exist, then no error message is printed and this is initially empty.  The file is expected to contain a sequence of lines in the format "<host>:port\n".  Lines not in this format are silently ignored.
 */
public void initialize(){
  String filename=settings.getHostList();
  try {
    if (filename != null)     read(filename);
  }
 catch (  FileNotFoundException e) {
  }
catch (  IOException e) {
  }
  Runnable updater=new Runnable(){
    public void run(){
      if (RouterService.acceptedIncomingConnection() && RouterService.isSupernode()) {
        Endpoint e=new Endpoint(RouterService.getAddress(),RouterService.getPort());
        gWebCache.sendUpdatesAsync(e);
      }
    }
  }
;
  RouterService.schedule(updater,BootstrapServerManager.UPDATE_DELAY_MSEC,BootstrapServerManager.UPDATE_DELAY_MSEC);
}

Fixed version (ground truth):
/** 
 * Links the HostCatcher up with the other back end pieces, and, if quick connect is not specified in the SettingsManager, loads the hosts in the host list into the maybe set.  (The likelys set is empty.)  If filename does not exist, then no error message is printed and this is initially empty.  The file is expected to contain a sequence of lines in the format "<host>:port\n".  Lines not in this format are silently ignored.
 */
public void initialize(){
  String filename=settings.getHostList();
  try {
    if (filename != null)     read(filename);
  }
 catch (  FileNotFoundException e) {
  }
catch (  IOException e) {
  }
  Runnable updater=new Runnable(){
    public void run(){
      try {
        if (RouterService.acceptedIncomingConnection() && RouterService.isSupernode()) {
          Endpoint e=new Endpoint(RouterService.getAddress(),RouterService.getPort());
          gWebCache.sendUpdatesAsync(e);
        }
      }
 catch (      Throwable t) {
        RouterService.error(t);
      }
    }
  }
;
  RouterService.schedule(updater,BootstrapServerManager.UPDATE_DELAY_MSEC,BootstrapServerManager.UPDATE_DELAY_MSEC);
}
Program: 4777
Project: 4777
Buggy source:
/** 
 * While the connection is not closed, sends all data delay. 
 */
public void run(){
  while (true) {
    repOk();
    try {
      waitForQueued();
      sendQueued();
    }
 catch (    IOException e) {
      if (_manager != null)       _manager.remove(ManagedConnection.this);
      _runnerDied=true;
      return;
    }
    repOk();
  }
}

Fixed version (ground truth):
/** 
 * While the connection is not closed, sends all data delay. 
 */
public void run(){
  try {
    while (true) {
      repOk();
      try {
        waitForQueued();
        sendQueued();
      }
 catch (      IOException e) {
        if (_manager != null)         _manager.remove(ManagedConnection.this);
        _runnerDied=true;
        return;
      }
      repOk();
    }
  }
 catch (  Throwable t) {
    RouterService.error(t);
  }
}
Program: 4778
Project: 4778
Buggy source:
public void run(){
  queryLoop();
}

Fixed version (ground truth):
public void run(){
  try {
    queryLoop();
  }
 catch (  Throwable t) {
    RouterService.error(t);
  }
}
Program: 4779
Project: 4779
Buggy source:
private QueryUnicaster(){
  _queries=new Hashtable();
  _queryHosts=new LinkedList();
  _pingList=new FixedSizeList(25);
  _querySets=new Hashtable();
  _qGuidsToRemove=new Vector();
  _querier=new Thread(){
    public void run(){
      queryLoop();
    }
  }
;
  if (SettingsManager.instance().getGuessEnabled())   _querier.start();
}

Fixed version (ground truth):
private QueryUnicaster(){
  _queries=new Hashtable();
  _queryHosts=new LinkedList();
  _pingList=new FixedSizeList(25);
  _querySets=new Hashtable();
  _qGuidsToRemove=new Vector();
  _querier=new Thread(){
    public void run(){
      try {
        queryLoop();
      }
 catch (      Throwable t) {
        RouterService.error(t);
      }
    }
  }
;
  if (SettingsManager.instance().getGuessEnabled())   _querier.start();
}
Program: 4780
Project: 4780
Buggy source:
public void run(){
  Set reqUrns=new HashSet();
  reqUrns.add(UrnType.ANY_TYPE);
  QueryRequest qr=new QueryRequest(guid,SETTINGS.getTTL(),minSpeed,query,richQuery,false,reqUrns,null);
  verifier.record(qr,type);
  router.broadcastQueryRequest(qr);
}

Fixed version (ground truth):
public void run(){
  try {
    Set reqUrns=new HashSet();
    reqUrns.add(UrnType.ANY_TYPE);
    QueryRequest qr=new QueryRequest(guid,SETTINGS.getTTL(),minSpeed,query,richQuery,false,reqUrns,null);
    verifier.record(qr,type);
    router.broadcastQueryRequest(qr);
  }
 catch (  Throwable t) {
    RouterService.error(t);
  }
}
Program: 4781
Project: 4781
Buggy source:
/** 
 * Shuts down the backend and writes the gnutella.net file.
 */
public static void shutdown(){
  Statistics.instance().shutdown();
  try {
    catcher.write(SETTINGS.getHostList());
  }
 catch (  IOException e) {
  }
 finally {
    SETTINGS.writeProperties();
  }
  File incompleteDir=null;
  try {
    incompleteDir=SETTINGS.getIncompleteDirectory();
  }
 catch (  java.io.FileNotFoundException fnfe) {
    return;
  }
  String[] files=incompleteDir.list();
  if (files == null)   return;
  for (int i=0; i < files.length; i++) {
    if (files[i].startsWith(IncompleteFileManager.PREVIEW_PREFIX)) {
      File file=new File(incompleteDir,files[i]);
      file.delete();
    }
  }
  downloader.writeSnapshot();
  Cookies.instance().save();
  UrnCache.instance().persistCache();
}

Fixed version (ground truth):
/** 
 * Shuts down the backend and writes the gnutella.net file.
 */
public static void shutdown(){
  try {
    Statistics.instance().shutdown();
    try {
      catcher.write(SETTINGS.getHostList());
    }
 catch (    IOException e) {
    }
 finally {
      SETTINGS.writeProperties();
    }
    File incompleteDir=null;
    try {
      incompleteDir=SETTINGS.getIncompleteDirectory();
    }
 catch (    java.io.FileNotFoundException fnfe) {
      return;
    }
    String[] files=incompleteDir.list();
    if (files == null)     return;
    for (int i=0; i < files.length; i++) {
      if (files[i].startsWith(IncompleteFileManager.PREVIEW_PREFIX)) {
        File file=new File(incompleteDir,files[i]);
        file.delete();
      }
    }
    downloader.writeSnapshot();
    Cookies.instance().save();
    UrnCache.instance().persistCache();
  }
 catch (  Throwable t) {
    RouterService.error(t);
  }
}
Program: 4782
Project: 4782
Buggy source:
/** 
 * Writes out the properties file to with the specified name in the user's install directory.  This should only get called once when the program shuts down.
 */
public void writeProperties(){
  FileOutputStream ostream=null;
  try {
    ostream=new FileOutputStream(PROPS_FILE);
    PROPS.save(ostream,"String_Node_Str");
    ostream.close();
  }
 catch (  Exception e) {
    showInternalError(e);
  }
 finally {
    try {
      if (ostream != null)       ostream.close();
    }
 catch (    IOException e) {
      showInternalError(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Writes out the properties file to with the specified name in the user's install directory.  This should only get called once when the program shuts down.
 */
public void writeProperties(){
  FileOutputStream ostream=null;
  try {
    ostream=new FileOutputStream(PROPS_FILE);
    PROPS.save(ostream,"String_Node_Str");
    ostream.close();
  }
 catch (  Throwable e) {
    showInternalError(e);
  }
 finally {
    try {
      if (ostream != null)       ostream.close();
    }
 catch (    IOException e) {
      showInternalError(e);
    }
  }
}
Program: 4783
Project: 4783
Buggy source:
/** 
 * Schedules a timer event to continually updates the upload and download bandwidth used.  Non-blocking.
 * @param router provides the schedule(..) method for the timing
 */
public void start(){
  Runnable task=new Runnable(){
    public void run(){
      collectBandwidthData();
    }
  }
;
  RouterService.schedule(task,0,TIMER_DELAY);
}

Fixed version (ground truth):
/** 
 * Schedules a timer event to continually updates the upload and download bandwidth used.  Non-blocking.
 * @param router provides the schedule(..) method for the timing
 */
public void start(){
  Runnable task=new Runnable(){
    public void run(){
      try {
        collectBandwidthData();
      }
 catch (      Throwable t) {
        RouterService.error(t);
      }
    }
  }
;
  RouterService.schedule(task,0,TIMER_DELAY);
}
Program: 4784
Project: 4784
Buggy source:
public void run(){
  collectBandwidthData();
}

Fixed version (ground truth):
public void run(){
  try {
    collectBandwidthData();
  }
 catch (  Throwable t) {
    RouterService.error(t);
  }
}
Program: 4785
Project: 4785
Buggy source:
public synchronized boolean resume() throws AlreadyDownloadingException {
  if (!(state == WAITING_FOR_RETRY || state == GAVE_UP || state == ABORTED || state == WAITING_FOR_RESULTS))   return false;
  String conflict=this.manager.conflicts(allFiles,this);
  if (conflict != null)   throw new AlreadyDownloadingException(conflict);
  if (state == GAVE_UP || state == ABORTED) {
    initialize(this.manager,this.fileManager,this.callback);
  }
 else   if (state == WAITING_FOR_RETRY) {
    if (dloaderManagerThread != null)     dloaderManagerThread.interrupt();
  }
 else   if (state == WAITING_FOR_RESULTS) {
    reqLock.release();
  }
  return true;
}

Fixed version (ground truth):
public boolean resume() throws AlreadyDownloadingException {
synchronized (this) {
    if (!(state == WAITING_FOR_RETRY || state == GAVE_UP || state == ABORTED || state == WAITING_FOR_RESULTS))     return false;
  }
  String conflict=this.manager.conflicts(allFiles,this);
  if (conflict != null)   throw new AlreadyDownloadingException(conflict);
synchronized (this) {
    if (state == GAVE_UP || state == ABORTED) {
      initialize(this.manager,this.fileManager,this.callback);
    }
 else     if (state == WAITING_FOR_RETRY) {
      if (dloaderManagerThread != null)       dloaderManagerThread.interrupt();
    }
 else     if (state == WAITING_FOR_RESULTS) {
      reqLock.release();
    }
    return true;
  }
}
Program: 4787
Project: 4787
Buggy source:
public void testSoftMax(){
  UploadManager upManager=new UploadManager();
  SettingsManager.instance().setMaxUploads(9999);
  SettingsManager.instance().setSoftMaxUploads(2);
  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");
    }
    kill(d1);
    Thread.sleep((UploadManager.MIN_POLL_TIME + UploadManager.MAX_POLL_TIME) / 2);
    try {
      connectDloader(d3,false,rfd3,true);
    }
 catch (    QueuedException e) {
      e.printStackTrace();
      fail("String_Node_Str" + e.getQueuePosition());
    }
catch (    TryAgainLaterException tlx) {
      fail("String_Node_Str");
    }
catch (    Exception ign) {
      ign.printStackTrace();
    }
    System.out.println("String_Node_Str");
  }
 catch (  Exception anyother) {
    System.out.println("String_Node_Str");
    anyother.printStackTrace();
  }
}

Fixed version (ground truth):
public void testSoftMax(){
  UploadManager upManager=new UploadManager();
  setUploadManager(upManager);
  SettingsManager.instance().setMaxUploads(9999);
  SettingsManager.instance().setSoftMaxUploads(2);
  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");
    }
    kill(d1);
    Thread.sleep((UploadManager.MIN_POLL_TIME + UploadManager.MAX_POLL_TIME) / 2);
    try {
      connectDloader(d3,false,rfd3,true);
    }
 catch (    QueuedException e) {
      e.printStackTrace();
      fail("String_Node_Str" + e.getQueuePosition());
    }
catch (    TryAgainLaterException tlx) {
      fail("String_Node_Str");
    }
catch (    Exception ign) {
      ign.printStackTrace();
    }
    System.out.println("String_Node_Str");
  }
 catch (  Exception anyother) {
    System.out.println("String_Node_Str");
    anyother.printStackTrace();
  }
}