Program: 116897
Project: 116897
Buggy source:
/** 
 * Execute a request
 * @param httpMethodProxyRequest
 * @param httpServletRequest
 * @param httpServletResponse
 * @param history
 * @throws Exception
 */
private void executeRequest(HttpMethod httpMethodProxyRequest,HttpServletRequest httpServletRequest,PluginResponse httpServletResponse,History history) throws Exception {
  int intProxyResponseCode=999;
  try {
    HttpClient httpClient=new HttpClient();
    httpMethodProxyRequest.setFollowRedirects(false);
    ArrayList<String> headersToRemove=getRemoveHeaders();
    httpClient.getParams().setSoTimeout(60000);
    httpServletRequest.setAttribute("String_Node_Str",headersToRemove);
    HttpMethodRetryHandler noretryhandler=new HttpMethodRetryHandler(){
      public boolean retryMethod(      final HttpMethod method,      final IOException exception,      int executionCount){
        return false;
      }
    }
;
    httpMethodProxyRequest.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,noretryhandler);
    intProxyResponseCode=httpClient.executeMethod(httpMethodProxyRequest);
  }
 catch (  Exception e) {
    httpServletResponse.setStatus(504);
    httpServletResponse.setHeader(Constants.HEADER_STATUS,"String_Node_Str");
    httpServletResponse.flushBuffer();
    return;
  }
  logger.info("String_Node_Str",intProxyResponseCode,HttpUtilities.getURL(httpMethodProxyRequest.getURI().toString()));
  if (intProxyResponseCode >= HttpServletResponse.SC_MULTIPLE_CHOICES && intProxyResponseCode < HttpServletResponse.SC_NOT_MODIFIED) {
    String stringStatusCode=Integer.toString(intProxyResponseCode);
    processRedirect(stringStatusCode,httpMethodProxyRequest,httpServletRequest,httpServletResponse);
  }
 else {
    httpServletResponse.setStatus(intProxyResponseCode);
    Header[] headerArrayResponse=httpMethodProxyRequest.getResponseHeaders();
    for (    Header header : headerArrayResponse) {
      httpServletResponse.setHeader(header.getName(),header.getValue());
    }
    if (intProxyResponseCode != HttpServletResponse.SC_NOT_MODIFIED) {
      InputStream inputStreamProxyResponse=httpMethodProxyRequest.getResponseBodyAsStream();
      BufferedInputStream bufferedInputStream=new BufferedInputStream(inputStreamProxyResponse);
      int intNextByte;
      httpServletResponse.resetBuffer();
      while ((intNextByte=bufferedInputStream.read()) != -1) {
        httpServletResponse.getOutputStream().write(intNextByte);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Execute a request
 * @param httpMethodProxyRequest
 * @param httpServletRequest
 * @param httpServletResponse
 * @param history
 * @throws Exception
 */
private void executeRequest(HttpMethod httpMethodProxyRequest,HttpServletRequest httpServletRequest,PluginResponse httpServletResponse,History history) throws Exception {
  int intProxyResponseCode=999;
  HttpClient httpClient=new HttpClient();
  HttpState state=new HttpState();
  try {
    httpMethodProxyRequest.setFollowRedirects(false);
    ArrayList<String> headersToRemove=getRemoveHeaders();
    httpClient.getParams().setSoTimeout(60000);
    httpServletRequest.setAttribute("String_Node_Str",headersToRemove);
    HttpMethodRetryHandler noretryhandler=new HttpMethodRetryHandler(){
      public boolean retryMethod(      final HttpMethod method,      final IOException exception,      int executionCount){
        return false;
      }
    }
;
    httpMethodProxyRequest.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,noretryhandler);
    intProxyResponseCode=httpClient.executeMethod(httpMethodProxyRequest.getHostConfiguration(),httpMethodProxyRequest,state);
  }
 catch (  Exception e) {
    httpServletResponse.setStatus(504);
    httpServletResponse.setHeader(Constants.HEADER_STATUS,"String_Node_Str");
    httpServletResponse.flushBuffer();
    return;
  }
  logger.info("String_Node_Str",intProxyResponseCode,HttpUtilities.getURL(httpMethodProxyRequest.getURI().toString()));
  httpServletResponse.setStatus(intProxyResponseCode);
  Header[] headerArrayResponse=httpMethodProxyRequest.getResponseHeaders();
  for (  Header header : headerArrayResponse) {
    httpServletResponse.setHeader(header.getName(),header.getValue());
  }
  if (intProxyResponseCode != HttpServletResponse.SC_NOT_MODIFIED) {
    InputStream inputStreamProxyResponse=httpMethodProxyRequest.getResponseBodyAsStream();
    BufferedInputStream bufferedInputStream=new BufferedInputStream(inputStreamProxyResponse);
    int intNextByte;
    httpServletResponse.resetBuffer();
    while ((intNextByte=bufferedInputStream.read()) != -1) {
      httpServletResponse.getOutputStream().write(intNextByte);
    }
    for (    Cookie cookie : state.getCookies()) {
      javax.servlet.http.Cookie servletCookie=new javax.servlet.http.Cookie(cookie.getName(),cookie.getValue());
      if (cookie.getPath() != null)       servletCookie.setPath(cookie.getPath());
      if (cookie.getDomain() != null)       servletCookie.setDomain(cookie.getDomain());
      if (cookie.getExpiryDate() != null)       servletCookie.setMaxAge((int)((cookie.getExpiryDate().getTime() - System.currentTimeMillis()) / 1000));
      servletCookie.setSecure(cookie.getSecure());
      servletCookie.setVersion(cookie.getVersion());
      if (cookie.getComment() != null)       servletCookie.setComment(cookie.getComment());
      httpServletResponse.addCookie(servletCookie);
    }
  }
}