Program: 28611
Project: 28611
Buggy source:
/** 
 * Sends a temporary or permanent redirect to the specified redirect location URL.
 * @param location Location URL to redirect to
 * @param isTemporary true if the redirect is supposed to be temporary,false if permanent
 * @throws IllegalStateException if this response hasalready been committed
 * @throws IOException if an input/output error occurs
 */
public void sendRedirect(String location,boolean isTemporary) throws IOException {
  if (isCommitted())   throw new IllegalStateException(rb.getString(CANNOT_CALL_SEND_REDIRECT_EXCEPTION));
  if (included)   return;
  resetBuffer();
  try {
    String absolute;
    if (getContext().getAllowRelativeRedirect())     absolute=location;
 else     absolute=toAbsolute(location);
    if (isTemporary) {
      setStatus(SC_MOVED_TEMPORARILY);
    }
 else {
      setStatus(SC_MOVED_PERMANENTLY);
    }
    setHeader("String_Node_Str",absolute);
    setContentType("String_Node_Str");
    setLocale(Locale.getDefault());
    HtmlEntityEncoder htmlEntityEncoder=new HtmlEntityEncoder();
    String href=htmlEntityEncoder.encode(absolute);
    StringBuilder sb=new StringBuilder(150 + href.length());
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append(href);
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    try {
      getWriter().write(sb.toString());
    }
 catch (    IllegalStateException ise1) {
      try {
        getOutputStream().print(sb.toString());
      }
 catch (      IllegalStateException ise2) {
      }
    }
  }
 catch (  IllegalArgumentException e) {
    setStatus(SC_NOT_FOUND);
  }
  setSuspended(true);
}

Fixed version (ground truth):
/** 
 * Sends a temporary or permanent redirect to the specified redirect location URL.
 * @param location Location URL to redirect to
 * @param isTemporary true if the redirect is supposed to be temporary,false if permanent
 * @throws IllegalStateException if this response hasalready been committed
 * @throws IOException if an input/output error occurs
 */
public void sendRedirect(String location,boolean isTemporary) throws IOException {
  if (isCommitted())   throw new IllegalStateException(rb.getString(CANNOT_CALL_SEND_REDIRECT_EXCEPTION));
  if (included)   return;
  resetBuffer();
  try {
    String absolute;
    if (getContext().getAllowRelativeRedirect())     absolute=location;
 else     absolute=toAbsolute(location);
    if (isTemporary) {
      setStatus(SC_MOVED_TEMPORARILY);
    }
 else {
      setStatus(SC_MOVED_PERMANENTLY);
    }
    setHeader("String_Node_Str",absolute);
    setContentType("String_Node_Str");
    setLocale(Locale.getDefault());
    String href=HtmlEntityEncoder.encodeXSS(absolute);
    StringBuilder sb=new StringBuilder(150 + href.length());
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append(href);
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    try {
      getWriter().write(sb.toString());
    }
 catch (    IllegalStateException ise1) {
      try {
        getOutputStream().print(sb.toString());
      }
 catch (      IllegalStateException ise2) {
      }
    }
  }
 catch (  IllegalArgumentException e) {
    setStatus(SC_NOT_FOUND);
  }
  setSuspended(true);
}