Program: 30099
Project: 30099
Buggy source:
/** 
 * Handle an HTTP status code or Java exception by forwarding control to the location included in the specified errorPage object.  It is assumed that the caller has already recorded any request attributes that are to be forwarded to this page.  Return <code>true</code> if we successfully utilized the specified error page location, or <code>false</code> if the default error report should be rendered.
 * @param request The request being processed
 * @param response The response being generated
 * @param errorPage The errorPage directive we are obeying
 */
protected boolean custom(Request request,Response response,ErrorPage errorPage){
  if (debug >= 1)   log("String_Node_Str" + errorPage);
  HttpServletRequest hreq=(HttpServletRequest)request.getRequest();
  HttpServletResponse hres=(HttpServletResponse)response.getResponse();
  ((HttpRequest)request).setPathInfo(errorPage.getLocation());
  try {
    Integer statusCodeObj=(Integer)hreq.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
    int statusCode=statusCodeObj.intValue();
    String message=(String)hreq.getAttribute(RequestDispatcher.ERROR_MESSAGE);
    hres.setStatus(statusCode,message);
    request.lockSession();
    ServletContext servletContext=request.getContext().getServletContext();
    ApplicationDispatcher dispatcher=(ApplicationDispatcher)servletContext.getRequestDispatcher(errorPage.getLocation());
    if (hres.isCommitted()) {
      dispatcher.include(hreq,hres);
    }
 else {
      response.resetBuffer(true);
      dispatcher.dispatch(hreq,hres,DispatcherType.ERROR);
      response.setSuspended(false);
    }
    return (true);
  }
 catch (  Throwable t) {
    log("String_Node_Str" + errorPage,t);
    return (false);
  }
 finally {
    request.unlockSession();
  }
}

Fixed version (ground truth):
/** 
 * Handle an HTTP status code or Java exception by forwarding control to the location included in the specified errorPage object.  It is assumed that the caller has already recorded any request attributes that are to be forwarded to this page.  Return <code>true</code> if we successfully utilized the specified error page location, or <code>false</code> if the default error report should be rendered.
 * @param request The request being processed
 * @param response The response being generated
 * @param errorPage The errorPage directive we are obeying
 */
protected boolean custom(Request request,Response response,ErrorPage errorPage){
  if (debug >= 1)   log("String_Node_Str" + errorPage);
  HttpServletRequest hreq=(HttpServletRequest)request.getRequest();
  HttpServletResponse hres=(HttpServletResponse)response.getResponse();
  ((HttpRequest)request).setPathInfo(errorPage.getLocation());
  try {
    Integer statusCodeObj=(Integer)hreq.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
    int statusCode=statusCodeObj.intValue();
    String message=(String)hreq.getAttribute(RequestDispatcher.ERROR_MESSAGE);
    hres.setStatus(statusCode,message);
    ServletContext servletContext=request.getContext().getServletContext();
    ApplicationDispatcher dispatcher=(ApplicationDispatcher)servletContext.getRequestDispatcher(errorPage.getLocation());
    if (hres.isCommitted()) {
      dispatcher.include(hreq,hres);
    }
 else {
      response.resetBuffer(true);
      dispatcher.dispatch(hreq,hres,DispatcherType.ERROR);
      response.setSuspended(false);
    }
    return (true);
  }
 catch (  Throwable t) {
    log("String_Node_Str" + errorPage,t);
    return (false);
  }
}