Program: 44840
Project: 44840
Buggy source:
/** 
 * Tests the speed of downloading with a single source using multiple connections, steadily increasing the number of connections to guage  the benefit.
 * @throws Exception If any unexpected error occurs.
 */
public void testNumConnections() throws Exception {
  if (!TEST_ACTIVE) {
    return;
  }
  final String urlString="String_Node_Str";
  final URI uri=new URI(urlString);
  final Collection<URI> uris=new LinkedList<URI>();
  uris.add(uri);
  final File testFile=new File("String_Node_Str");
  LOG.debug("String_Node_Str" + testFile.exists() + "String_Node_Str"+ testFile.length());
  testFile.delete();
  assertFalse(testFile.isFile());
  final long straighBaseline=download(urlString);
  final int straighBaselineSecs=(int)(straighBaseline / 1000);
  LOG.debug("String_Node_Str" + straighBaselineSecs + "String_Node_Str");
  final UriResolver resolver=new UriResolver(){
    public Collection<URI> resolve(    final URI uri) throws IOException {
      return uris;
    }
    public URI getSha1(){
      return null;
    }
  }
;
  long baseline=0;
  final File tempDownloadDir=new File("String_Node_Str");
  tempDownloadDir.mkdir();
  tempDownloadDir.deleteOnExit();
  for (int i=1; i < 16; i++) {
    final Downloader<MsDState> dl=new MultiSourceDownloader("String_Node_Str",testFile,uri,6509767L,"String_Node_Str",resolver,i,null,tempDownloadDir);
    final long start=System.currentTimeMillis();
    dl.start();
    final long end=System.currentTimeMillis();
    LOG.debug("String_Node_Str" + testFile.exists() + "String_Node_Str"+ testFile.length());
    testFile.delete();
    assertFalse(testFile.isFile());
    final long duration=end - start;
    final int durationSecs=(int)(duration / 1000);
    LOG.debug("String_Node_Str" + durationSecs + "String_Node_Str");
    if (i == 1) {
      LOG.debug("String_Node_Str" + durationSecs + "String_Node_Str");
      baseline=duration;
    }
 else {
      if (baseline > duration) {
        final long msSaved=baseline - duration;
        final int secondsSaved=(int)(msSaved / 1000);
        LOG.debug("String_Node_Str" + secondsSaved + "String_Node_Str");
        final float percentSaved=(float)msSaved / (float)baseline;
        LOG.debug((percentSaved * 100) + "String_Node_Str" + i+ "String_Node_Str");
      }
 else {
        final int secondsLost=(int)((duration - baseline) / 60);
        LOG.debug("String_Node_Str" + secondsLost);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Tests the speed of downloading with a single source using multiple connections, steadily increasing the number of connections to guage  the benefit.
 * @throws Exception If any unexpected error occurs.
 */
public void testNumConnections() throws Exception {
  if (!TEST_ACTIVE) {
    return;
  }
  final String urlString="String_Node_Str";
  final URI uri=new URI(urlString);
  final Collection<URI> uris=new LinkedList<URI>();
  uris.add(uri);
  final File testFile=new File("String_Node_Str");
  LOG.debug("String_Node_Str" + testFile.exists() + "String_Node_Str"+ testFile.length());
  testFile.delete();
  assertFalse(testFile.isFile());
  final long straighBaseline=download(urlString);
  final int straighBaselineSecs=(int)(straighBaseline / 1000);
  LOG.debug("String_Node_Str" + straighBaselineSecs + "String_Node_Str");
  final UriResolver resolver=new UriResolver(){
    public Collection<URI> resolve(    final URI uri) throws IOException {
      return uris;
    }
    public URI getSha1(){
      return null;
    }
  }
;
  long baseline=0;
  final File tempDownloadDir=new File("String_Node_Str");
  tempDownloadDir.mkdir();
  tempDownloadDir.deleteOnExit();
  for (int i=1; i < 16; i++) {
    final Downloader<MsDState> dl=new MultiSourceDownloader(testFile,uri,6509767L,"String_Node_Str",resolver,i,null,tempDownloadDir);
    final long start=System.currentTimeMillis();
    dl.start();
    final long end=System.currentTimeMillis();
    LOG.debug("String_Node_Str" + testFile.exists() + "String_Node_Str"+ testFile.length());
    testFile.delete();
    assertFalse(testFile.isFile());
    final long duration=end - start;
    final int durationSecs=(int)(duration / 1000);
    LOG.debug("String_Node_Str" + durationSecs + "String_Node_Str");
    if (i == 1) {
      LOG.debug("String_Node_Str" + durationSecs + "String_Node_Str");
      baseline=duration;
    }
 else {
      if (baseline > duration) {
        final long msSaved=baseline - duration;
        final int secondsSaved=(int)(msSaved / 1000);
        LOG.debug("String_Node_Str" + secondsSaved + "String_Node_Str");
        final float percentSaved=(float)msSaved / (float)baseline;
        LOG.debug((percentSaved * 100) + "String_Node_Str" + i+ "String_Node_Str");
      }
 else {
        final int secondsLost=(int)((duration - baseline) / 60);
        LOG.debug("String_Node_Str" + secondsLost);
      }
    }
  }
}