Program: 4515
Project: 4515
Buggy source:
/** 
 * Steals a grey area from the biggesr HHTPDownloader and gives it to the HTTPDownloader this method will return.  <p>  If there is less than MIN_SPLIT_SIZE left, we will assign the entire area to a new HTTPDownloader, if the current downloader is going too slow.
 */
private void assignGrey(HTTPDownloader dloader,boolean http11) throws NoSuchElementException, IOException, TryAgainLaterException, QueuedException, FileNotFoundException, NotSharingException, NoSuchRangeException {
  if (dloader.getRemoteFileDesc().isPartialSource())   throw new NoSuchRangeException();
  HTTPDownloader biggest=null;
synchronized (this) {
    for (Iterator iter=dloaders.iterator(); iter.hasNext(); ) {
      HTTPDownloader h=(HTTPDownloader)iter.next();
      if (h.isActive() && (biggest == null || h.getAmountToRead() > biggest.getAmountToRead()))       biggest=h;
    }
  }
  if (biggest == null) {
    throw new NoSuchElementException();
  }
  int amountRead=biggest.getAmountRead();
  int left=biggest.getAmountToRead() - amountRead;
  if ((http11 && left < CHUNK_SIZE) || (!http11 && left < MIN_SPLIT_SIZE)) {
    float bandwidthVictim=-1;
    float bandwidthStealer=-1;
    try {
      bandwidthVictim=biggest.getAverageBandwidth();
      biggest.getMeasuredBandwidth();
    }
 catch (    InsufficientDataException ide) {
      LOG.debug("String_Node_Str",ide);
      bandwidthVictim=-1;
    }
    try {
      bandwidthStealer=dloader.getAverageBandwidth();
      dloader.getMeasuredBandwidth();
    }
 catch (    InsufficientDataException ide) {
      LOG.debug("String_Node_Str",ide);
      bandwidthStealer=-1;
    }
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str" + dloader + "String_Node_Str"+ biggest+ "String_Node_Str"+ bandwidthStealer+ "String_Node_Str"+ bandwidthVictim+ "String_Node_Str");
    if ((bandwidthVictim != -1 && bandwidthVictim < MIN_ACCEPTABLE_SPEED) || (bandwidthStealer > MIN_ACCEPTABLE_SPEED && bandwidthStealer > bandwidthVictim)) {
      int start=biggest.getInitialReadingPoint() + amountRead;
      int stop=biggest.getInitialReadingPoint() + biggest.getAmountToRead();
      dloader.connectHTTP(getOverlapOffset(start),stop,false);
      int newLow=dloader.getInitialReadingPoint();
      int newHigh=dloader.getAmountToRead() + newLow;
      if (newLow > start || newHigh < stop) {
        if (LOG.isDebugEnabled())         LOG.debug("String_Node_Str" + "String_Node_Str" + start + "String_Node_Str"+ stop+ "String_Node_Str"+ newLow+ "String_Node_Str"+ newHigh);
        throw new IOException("String_Node_Str");
      }
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + start + "String_Node_Str"+ stop+ "String_Node_Str"+ biggest+ "String_Node_Str"+ dloader);
      biggest.stopAt(start);
      biggest.stop();
    }
 else {
      throw new NoSuchElementException();
    }
  }
 else {
    int start;
    if (http11) {
      start=biggest.getInitialReadingPoint() + biggest.getAmountToRead() - CHUNK_SIZE + 1;
    }
 else {
      start=biggest.getInitialReadingPoint() + amountRead + left / 2;
    }
    int stop=biggest.getInitialReadingPoint() + biggest.getAmountToRead();
    dloader.connectHTTP(getOverlapOffset(start),stop,true);
    int newLow=dloader.getInitialReadingPoint();
    int newHigh=dloader.getAmountToRead() + newLow;
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str" + newLow + "String_Node_Str"+ newHigh+ "String_Node_Str"+ biggest+ "String_Node_Str"+ dloader);
    if (newLow > start)     start=newLow;
    biggest.stopAt(start);
  }
}

Fixed version (ground truth):
/** 
 * Steals a grey area from the biggesr HHTPDownloader and gives it to the HTTPDownloader this method will return.  <p>  If there is less than MIN_SPLIT_SIZE left, we will assign the entire area to a new HTTPDownloader, if the current downloader is going too slow.
 */
private void assignGrey(HTTPDownloader dloader,boolean http11) throws NoSuchElementException, IOException, TryAgainLaterException, QueuedException, FileNotFoundException, NotSharingException, NoSuchRangeException {
  if (dloader.getRemoteFileDesc().isPartialSource())   throw new NoSuchRangeException();
  HTTPDownloader biggest=null;
synchronized (this) {
    for (Iterator iter=dloaders.iterator(); iter.hasNext(); ) {
      HTTPDownloader h=(HTTPDownloader)iter.next();
      if (h.isActive() && (biggest == null || h.getAmountToRead() > biggest.getAmountToRead()))       biggest=h;
    }
  }
  if (biggest == null) {
    throw new NoSuchElementException();
  }
  int amountRead=biggest.getAmountRead();
  int left=biggest.getAmountToRead() - amountRead;
  if ((http11 && left < CHUNK_SIZE) || (!http11 && left < MIN_SPLIT_SIZE)) {
    float bandwidthVictim=-1;
    float bandwidthStealer=-1;
    try {
      bandwidthVictim=biggest.getAverageBandwidth();
      biggest.getMeasuredBandwidth();
    }
 catch (    InsufficientDataException ide) {
      LOG.debug("String_Node_Str",ide);
      bandwidthVictim=-1;
    }
    try {
      bandwidthStealer=dloader.getAverageBandwidth();
      dloader.getMeasuredBandwidth();
    }
 catch (    InsufficientDataException ide) {
      LOG.debug("String_Node_Str",ide);
      bandwidthStealer=-1;
    }
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str" + dloader + "String_Node_Str"+ biggest+ "String_Node_Str"+ bandwidthStealer+ "String_Node_Str"+ bandwidthVictim+ "String_Node_Str");
    if ((bandwidthVictim != -1 && bandwidthVictim < MIN_ACCEPTABLE_SPEED) || (bandwidthStealer > MIN_ACCEPTABLE_SPEED && bandwidthStealer > bandwidthVictim)) {
      int start=biggest.getInitialReadingPoint() + amountRead;
      int stop=biggest.getInitialReadingPoint() + biggest.getAmountToRead();
      dloader.connectHTTP(getOverlapOffset(start),stop,false);
      int newLow=dloader.getInitialReadingPoint();
      int newHigh=dloader.getAmountToRead() + newLow;
      if (newLow > start || newHigh < stop) {
        if (LOG.isDebugEnabled())         LOG.debug("String_Node_Str" + "String_Node_Str" + start + "String_Node_Str"+ stop+ "String_Node_Str"+ newLow+ "String_Node_Str"+ newHigh);
        throw new IOException("String_Node_Str");
      }
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + start + "String_Node_Str"+ stop+ "String_Node_Str"+ biggest+ "String_Node_Str"+ dloader);
      biggest.stopAt(start);
      biggest.stop();
    }
 else {
      throw new NoSuchElementException();
    }
  }
 else {
    int start;
    if (http11) {
      start=biggest.getInitialReadingPoint() + biggest.getAmountToRead() - CHUNK_SIZE + 1;
    }
 else {
      start=biggest.getInitialReadingPoint() + amountRead + left / 2;
    }
    int stop=biggest.getInitialReadingPoint() + biggest.getAmountToRead();
    dloader.connectHTTP(getOverlapOffset(start),stop,true);
    int newLow=dloader.getInitialReadingPoint();
    int newHigh=dloader.getAmountToRead() + newLow;
    if (newHigh < stop) {
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + "String_Node_Str" + stop + "String_Node_Str"+ newHigh);
      throw new IOException("String_Node_Str");
    }
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str" + newLow + "String_Node_Str"+ newHigh+ "String_Node_Str"+ biggest+ "String_Node_Str"+ dloader);
    if (newLow > start)     start=newLow;
    biggest.stopAt(start);
  }
}