Program: 94471
Project: 94471
Buggy source:
private boolean openStreamsForResume(){
  Trace.entering(Activator.PLUGIN_ID,DebugOptions.METHODS_ENTERING,this.getClass(),"String_Node_Str");
  final URL theURL=getRemoteFileURL();
  int code=-1;
  try {
    remoteFileURL=new URL(theURL.toString());
    final String urlString=getRemoteFileURL().toString();
    httpClient.getHttpConnectionManager().getParams().setSoTimeout(DEFAULT_READ_TIMEOUT);
    httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    setupAuthentication(urlString);
    setupHostAndPort(urlString);
    String path=hostConfigHelper.getTargetRelativePath();
    getMethod=new GzipGetMethod(path);
    getMethod.setFollowRedirects(true);
    setResumeRequestHeaderValues();
    Trace.trace(Activator.PLUGIN_ID,"String_Node_Str" + urlString);
    code=httpClient.executeMethod(getHostConfiguration(),getMethod);
    Trace.trace(Activator.PLUGIN_ID,"String_Node_Str" + code);
    if (code == HttpURLConnection.HTTP_PARTIAL || code == HttpURLConnection.HTTP_OK) {
      getResumeResponseHeaderValues();
      setInputStream(getMethod.getResponseBodyAsUnzippedStream());
      this.paused=false;
      fireReceiveResumedEvent();
    }
 else     if (code == HttpURLConnection.HTTP_NOT_FOUND) {
      getMethod.releaseConnection();
      throw new FileNotFoundException(urlString);
    }
 else     if (code == HttpURLConnection.HTTP_UNAUTHORIZED || code == HttpURLConnection.HTTP_FORBIDDEN) {
      getMethod.getResponseBody();
      getMethod.releaseConnection();
      throw new IncomingFileTransferException(Messages.HttpClientRetrieveFileTransfer_Unauthorized,code);
    }
 else     if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
      getMethod.releaseConnection();
      throw new LoginException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required);
    }
 else {
      getMethod.releaseConnection();
      throw new IOException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE,new Integer(code)));
    }
    Trace.exiting(Activator.PLUGIN_ID,DebugOptions.METHODS_EXITING,this.getClass(),"String_Node_Str",Boolean.TRUE);
    return true;
  }
 catch (  final Exception e) {
    setDoneException(e);
    Trace.catching(Activator.PLUGIN_ID,DebugOptions.EXCEPTIONS_THROWING,this.getClass(),"String_Node_Str",e);
    hardClose();
    fireTransferReceiveDoneEvent();
    Trace.exiting(Activator.PLUGIN_ID,DebugOptions.EXCEPTIONS_THROWING,this.getClass(),"String_Node_Str",Boolean.FALSE);
    return false;
  }
}

Fixed version (ground truth):
private boolean openStreamsForResume(){
  Trace.entering(Activator.PLUGIN_ID,DebugOptions.METHODS_ENTERING,this.getClass(),"String_Node_Str");
  final String urlString=getRemoteFileURL().toString();
  this.doneFired=false;
  int code=-1;
  try {
    httpClient.getHttpConnectionManager().getParams().setSoTimeout(DEFAULT_READ_TIMEOUT);
    httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    setupAuthentication(urlString);
    setupHostAndPort(urlString);
    getMethod=new GzipGetMethod(hostConfigHelper.getTargetRelativePath());
    getMethod.setFollowRedirects(true);
    getMethod.getParams().setParameter(CredentialsProvider.PROVIDER,new ECFCredentialsProvider());
    setResumeRequestHeaderValues();
    Trace.trace(Activator.PLUGIN_ID,"String_Node_Str" + urlString);
    fireConnectStartEvent();
    if (checkAndHandleDone()) {
      return false;
    }
    connectingSockets.clear();
    if (connectJob == null) {
      performConnect(new NullProgressMonitor());
    }
 else {
      connectJob.schedule();
      connectJob.join();
      connectJob=null;
    }
    if (checkAndHandleDone()) {
      return false;
    }
    code=responseCode;
    Trace.trace(Activator.PLUGIN_ID,"String_Node_Str" + code);
    if (code == HttpURLConnection.HTTP_PARTIAL || code == HttpURLConnection.HTTP_OK) {
      getResumeResponseHeaderValues();
      setInputStream(getMethod.getResponseBodyAsUnzippedStream());
      this.paused=false;
      fireReceiveResumedEvent();
    }
 else     if (code == HttpURLConnection.HTTP_NOT_FOUND) {
      getMethod.releaseConnection();
      throw new FileNotFoundException(urlString);
    }
 else     if (code == HttpURLConnection.HTTP_UNAUTHORIZED) {
      getMethod.releaseConnection();
      throw new LoginException(Messages.HttpClientRetrieveFileTransfer_Unauthorized);
    }
 else     if (code == HttpURLConnection.HTTP_FORBIDDEN) {
      getMethod.releaseConnection();
      throw new LoginException("String_Node_Str");
    }
 else     if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
      getMethod.releaseConnection();
      throw new LoginException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required);
    }
 else {
      getMethod.releaseConnection();
      throw new IOException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE,new Integer(code)));
    }
    Trace.exiting(Activator.PLUGIN_ID,DebugOptions.METHODS_EXITING,this.getClass(),"String_Node_Str",Boolean.TRUE);
    return true;
  }
 catch (  final Exception e) {
    Trace.catching(Activator.PLUGIN_ID,DebugOptions.EXCEPTIONS_CATCHING,this.getClass(),"String_Node_Str",e);
    if (code == -1) {
      if (!isDone()) {
        setDoneException(e);
      }
    }
 else {
      setDoneException(new IncomingFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT,urlString),e,code));
    }
    fireTransferReceiveDoneEvent();
    Trace.exiting(Activator.PLUGIN_ID,DebugOptions.METHODS_EXITING,this.getClass(),"String_Node_Str",Boolean.FALSE);
    return false;
  }
}