Program: 28620
Project: 28620
Buggy source:
/** 
 * Prints out an error report.
 * @param request The request being processed
 * @param response The response being generated
 * @param throwable The exception that occurred (which possibly wrapsa root cause exception
 */
protected void report(Request request,Response response,Throwable throwable) throws IOException {
  HttpResponse hresponse=(HttpResponse)response;
  HttpServletResponse hres=(HttpServletResponse)response;
  int statusCode=hresponse.getStatus();
  if (statusCode < 400 || (response.getContentCount() > 0))   return;
  Throwable rootCause=null;
  if (throwable != null) {
    if (throwable instanceof ServletException)     rootCause=((ServletException)throwable).getRootCause();
  }
  String message=hresponse.getMessage();
  if (message == null) {
    message=hresponse.getDetailMessage();
    if (message == null) {
      message="String_Node_Str";
    }
 else {
      HtmlEntityEncoder htmlEntityEncoder=new HtmlEntityEncoder();
      message=htmlEntityEncoder.encode(message);
    }
  }
  String report=null;
  try {
    report=sm.getString("String_Node_Str" + statusCode,message,hres.getLocale());
  }
 catch (  Throwable t) {
    ;
  }
  if (report == null)   return;
  String errorPage=makeErrorPage(statusCode,message,throwable,rootCause,report,hres);
  hres.setLocale(sm.getResourceBundleLocale(hres.getLocale()));
  try {
    hres.setContentType("String_Node_Str");
  }
 catch (  Throwable t) {
    if (debug >= 1)     log(rb.getString(SET_CONTENT_TYPE_EXCEPTION),t);
  }
  try {
    Writer writer=response.getReporter();
    if (writer != null) {
      writer.write(errorPage);
    }
  }
 catch (  IOException e) {
    ;
  }
catch (  IllegalStateException e) {
    ;
  }
}

Fixed version (ground truth):
/** 
 * Prints out an error report.
 * @param request The request being processed
 * @param response The response being generated
 * @param throwable The exception that occurred (which possibly wrapsa root cause exception
 */
protected void report(Request request,Response response,Throwable throwable) throws IOException {
  HttpResponse hresponse=(HttpResponse)response;
  HttpServletResponse hres=(HttpServletResponse)response;
  int statusCode=hresponse.getStatus();
  if (statusCode < 400 || (response.getContentCount() > 0))   return;
  Throwable rootCause=null;
  if (throwable != null) {
    if (throwable instanceof ServletException)     rootCause=((ServletException)throwable).getRootCause();
  }
  String message=hresponse.getMessage();
  if (message == null) {
    message=hresponse.getDetailMessage();
  }
  if (message == null) {
    message="String_Node_Str";
  }
 else {
    HtmlEntityEncoder htmlEntityEncoder=new HtmlEntityEncoder();
    message=htmlEntityEncoder.encode(message);
  }
  String report=null;
  try {
    report=sm.getString("String_Node_Str" + statusCode,message,hres.getLocale());
  }
 catch (  Throwable t) {
    ;
  }
  if (report == null)   return;
  String errorPage=makeErrorPage(statusCode,message,throwable,rootCause,report,hres);
  hres.setLocale(sm.getResourceBundleLocale(hres.getLocale()));
  try {
    hres.setContentType("String_Node_Str");
  }
 catch (  Throwable t) {
    if (debug >= 1)     log(rb.getString(SET_CONTENT_TYPE_EXCEPTION),t);
  }
  try {
    Writer writer=response.getReporter();
    if (writer != null) {
      writer.write(errorPage);
    }
  }
 catch (  IOException e) {
    ;
  }
catch (  IllegalStateException e) {
    ;
  }
}