Program: 4609
Project: 4609
Buggy source:
/** 
 * Attempts to run downloader.doDownload, notifying manager of termination via downloaders.notify().  To determine when this downloader should be removed from the dloaders list: never remove the downloader from dloaders if the uploader supports persistence, unless we get an exception - in which case we do not add it back to files.  If !http11, then we remove from the dloaders in the finally block and add to files as before if no problem was encountered.   
 * @param downloader the normal or push downloader to use for the transfer,which MUST be initialized (i.e., downloader.connectTCP() and connectHTTP() have been called)
 * @return true if there was no IOException while downloading, falseotherwise.  
 */
private boolean doDownload(HTTPDownloader downloader,boolean http11){
  debug("String_Node_Str" + downloader);
  boolean problem=false;
  RemoteFileDesc rfd=downloader.getRemoteFileDesc();
  try {
    downloader.doDownload(commonOutFile);
    rfd.resetFailedCount();
    if (RECORD_STATS) {
      if (http11)       DownloadStat.SUCCESFULL_HTTP11.incrementStat();
 else       DownloadStat.SUCCESFULL_HTTP10.incrementStat();
    }
    return true;
  }
 catch (  IOException e) {
    if (RECORD_STATS) {
      if (http11)       DownloadStat.FAILED_HTTP11.incrementStat();
 else       DownloadStat.FAILED_HTTP10.incrementStat();
    }
    problem=true;
    informMesh(downloader.getRemoteFileDesc(),false);
    chatList.removeHost(downloader);
    browseList.removeHost(downloader);
    return false;
  }
 finally {
    int stop=downloader.getInitialReadingPoint() + downloader.getAmountRead();
    debug("String_Node_Str" + downloader + "String_Node_Str"+ stop+ "String_Node_Str"+ problem);
synchronized (this) {
      if (problem) {
        updateNeeded(downloader);
        downloader.stop();
        rfd.incrementFailedCount();
        if (rfd.getFailedCount() < 2)         busy.add(rfd);
      }
      dloaders.remove(downloader);
      if (!problem && !http11)       files.add(rfd);
      if (!problem && rfd.isAltLocCapable()) {
        try {
          AlternateLocation loc=AlternateLocation.create(rfd);
          AlternateLocation loc2=AlternateLocation.create(rfd);
          informMesh(rfd,true);
          FileDesc desc=fileManager.getFileDescForFile(incompleteFile);
          if (desc != null)           desc.add(loc);
          addAlternateLocation(loc2);
        }
 catch (        IOException ignored) {
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Attempts to run downloader.doDownload, notifying manager of termination via downloaders.notify().  To determine when this downloader should be removed from the dloaders list: never remove the downloader from dloaders if the uploader supports persistence, unless we get an exception - in which case we do not add it back to files.  If !http11, then we remove from the dloaders in the finally block and add to files as before if no problem was encountered.   
 * @param downloader the normal or push downloader to use for the transfer,which MUST be initialized (i.e., downloader.connectTCP() and connectHTTP() have been called)
 * @return true if there was no IOException while downloading, falseotherwise.  
 */
private boolean doDownload(HTTPDownloader downloader,boolean http11){
  debug("String_Node_Str" + downloader);
  boolean problem=false;
  RemoteFileDesc rfd=downloader.getRemoteFileDesc();
  try {
    downloader.doDownload(commonOutFile);
    rfd.resetFailedCount();
    if (RECORD_STATS) {
      if (http11)       DownloadStat.SUCCESFULL_HTTP11.incrementStat();
 else       DownloadStat.SUCCESFULL_HTTP10.incrementStat();
    }
  }
 catch (  IOException e) {
    if (RECORD_STATS) {
      if (http11)       DownloadStat.FAILED_HTTP11.incrementStat();
 else       DownloadStat.FAILED_HTTP10.incrementStat();
    }
    problem=true;
    chatList.removeHost(downloader);
    browseList.removeHost(downloader);
  }
 finally {
    int stop=downloader.getInitialReadingPoint() + downloader.getAmountRead();
    debug("String_Node_Str" + downloader + "String_Node_Str"+ stop+ "String_Node_Str"+ problem);
synchronized (this) {
      if (problem) {
        updateNeeded(downloader);
        downloader.stop();
        rfd.incrementFailedCount();
        if (rfd.getFailedCount() < 2)         busy.add(rfd);
 else         informMesh(rfd,false);
      }
 else {
        informMesh(rfd,true);
        if (!http11)         files.add(rfd);
      }
      dloaders.remove(downloader);
    }
  }
  return !problem;
}