Program: 28543
Project: 28543
Buggy source:
/** 
 * Restore the original request from information stored in our session. If the original request is no longer present (because the session timed out), return <code>false</code>; otherwise, return <code>true</code>.
 * @param request The request to be restored
 * @param session The session containing the saved information
 */
protected boolean restoreRequest(HttpRequest request,Session session){
  SavedRequest saved=(SavedRequest)session.getNote(Constants.FORM_REQUEST_NOTE);
  session.removeNote(Constants.FORM_PRINCIPAL_NOTE);
  if (saved == null)   return (false);
  request.clearCookies();
  Iterator<Cookie> cookies=saved.getCookies();
  while (cookies.hasNext()) {
    request.addCookie(cookies.next());
  }
  request.clearHeaders();
  Iterator<String> names=saved.getHeaderNames();
  while (names.hasNext()) {
    String name=names.next();
    Iterator<String> values=saved.getHeaderValues(name);
    while (values.hasNext()) {
      request.addHeader(name,values.next());
    }
  }
  request.clearLocales();
  Iterator<Locale> locales=saved.getLocales();
  while (locales.hasNext()) {
    request.addLocale(locales.next());
  }
  request.clearParameters();
  if ("String_Node_Str".equalsIgnoreCase(saved.getMethod())) {
    Iterator<String> paramNames=saved.getParameterNames();
    while (paramNames.hasNext()) {
      String paramName=paramNames.next();
      String paramValues[]=saved.getParameterValues(paramName);
      request.addParameter(paramName,paramValues);
    }
  }
  request.setMethod(saved.getMethod());
  request.setQueryString(saved.getQueryString());
  request.setRequestURI(saved.getRequestURI());
  return (true);
}

Fixed version (ground truth):
/** 
 * Restore the original request from information stored in our session. If the original request is no longer present (because the session timed out), return <code>false</code>; otherwise, return <code>true</code>.
 * @param request The request to be restored
 * @param session The session containing the saved information
 */
protected boolean restoreRequest(HttpRequest request,Session session) throws IOException {
  SavedRequest saved=(SavedRequest)session.getNote(Constants.FORM_REQUEST_NOTE);
  session.removeNote(Constants.FORM_PRINCIPAL_NOTE);
  if (saved == null)   return (false);
  byte[] buffer=new byte[4096];
  InputStream is=request.getStream();
  while (is.read(buffer) >= 0) {
  }
  request.clearCookies();
  Iterator<Cookie> cookies=saved.getCookies();
  while (cookies.hasNext()) {
    request.addCookie(cookies.next());
  }
  String method=saved.getMethod();
  boolean cachable="String_Node_Str".equalsIgnoreCase(method) || "String_Node_Str".equalsIgnoreCase(method);
  request.clearHeaders();
  Iterator<String> names=saved.getHeaderNames();
  while (names.hasNext()) {
    String name=names.next();
    if (!("String_Node_Str".equalsIgnoreCase(name) || (cachable && "String_Node_Str".equalsIgnoreCase(name)))) {
      Iterator<String> values=saved.getHeaderValues(name);
      while (values.hasNext()) {
        request.addHeader(name,values.next());
      }
    }
  }
  request.setContentLength(saved.getContentLenght());
  request.clearLocales();
  Iterator<Locale> locales=saved.getLocales();
  while (locales.hasNext()) {
    request.addLocale(locales.next());
  }
  request.clearParameters();
  ByteChunk body=saved.getBody();
  if (body != null) {
    request.replayPayload(body.getBytes());
    String savedContentType=saved.getContentType();
    if (savedContentType == null && "String_Node_Str".equalsIgnoreCase(method)) {
      savedContentType="String_Node_Str";
    }
    request.setContentType(savedContentType);
  }
  request.setMethod(method);
  request.setQueryString(saved.getQueryString());
  return true;
}