Program: 3279
Project: 3279
Buggy source:
/** 
 * Generate the AJAX response Document. Looks for request parameters: field - MD field key, i.e. form key, REQUIRED - derivated from url. query - string to match collection - db ID of Collection ot serve as context start - index to start from, default 0. limit - max number of lines, default 1000. format - opt. result XML/XHTML format: "select", "ul", "xml"(default) locale - explicit locale, pass to choice plugin
 */
private void process(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  String[] paths=request.getPathInfo().split("String_Node_Str");
  String field=paths[paths.length - 1];
  ChoiceAuthorityManager cam=ChoiceAuthorityManager.getManager();
  String query=request.getParameter("String_Node_Str");
  String format=request.getParameter("String_Node_Str");
  int collection=UIUtil.getIntParameter(request,"String_Node_Str");
  int start=UIUtil.getIntParameter(request,"String_Node_Str");
  int limit=UIUtil.getIntParameter(request,"String_Node_Str");
  Choices result=cam.getMatches(field,query,collection,start,limit,null);
  Writer writer=response.getWriter();
  Properties props=OutputPropertiesFactory.getDefaultMethodProperties(Method.XML);
  Serializer ser=SerializerFactory.getSerializer(props);
  ser.setWriter(writer);
  try {
    ChoicesXMLGenerator.generate(result,format,ser.asContentHandler());
  }
 catch (  SAXException e) {
    throw new IOException(e.toString());
  }
 finally {
    ser.reset();
  }
  writer.flush();
}

Fixed version (ground truth):
/** 
 * Generate the AJAX response Document. Looks for request parameters: field - MD field key, i.e. form key, REQUIRED - derivated from url. query - string to match collection - db ID of Collection ot serve as context start - index to start from, default 0. limit - max number of lines, default 1000. format - opt. result XML/XHTML format: "select", "ul", "xml"(default) locale - explicit locale, pass to choice plugin
 */
private void process(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  String[] paths=request.getPathInfo().split("String_Node_Str");
  String field=paths[paths.length - 1];
  ChoiceAuthorityManager cam=ChoiceAuthorityManager.getManager();
  String query=request.getParameter("String_Node_Str");
  String format=request.getParameter("String_Node_Str");
  int collection=UIUtil.getIntParameter(request,"String_Node_Str");
  int start=UIUtil.getIntParameter(request,"String_Node_Str");
  int limit=UIUtil.getIntParameter(request,"String_Node_Str");
  Choices result=cam.getMatches(field,query,collection,start,limit,null);
  Writer writer=response.getWriter();
  response.setContentType("String_Node_Str");
  Properties props=OutputPropertiesFactory.getDefaultMethodProperties(Method.XML);
  Serializer ser=SerializerFactory.getSerializer(props);
  ser.setWriter(writer);
  try {
    ChoicesXMLGenerator.generate(result,format,ser.asContentHandler());
  }
 catch (  SAXException e) {
    throw new IOException(e.toString());
  }
 finally {
    ser.reset();
  }
  writer.flush();
}