Program: 3647
Project: 3647
Buggy source:
/** 
 * Create/update collection metadata from a posted form
 * @param context     DSpace context
 * @param request     the HTTP request containing posted info
 * @param response    the HTTP response
 * @param community   the community the collection is in
 * @param collection  the collection to update (or null for creation)
 */
private void processConfirmEditCollection(Context context,HttpServletRequest request,HttpServletResponse response,Community community,Collection collection) throws ServletException, IOException, SQLException, AuthorizeException {
  if (request.getParameter("String_Node_Str").equals("String_Node_Str")) {
    collection=community.createCollection();
    request.setAttribute("String_Node_Str",collection);
  }
  collection.setMetadata("String_Node_Str",request.getParameter("String_Node_Str"));
  collection.setMetadata("String_Node_Str",request.getParameter("String_Node_Str"));
  String intro=request.getParameter("String_Node_Str");
  if (intro.equals("String_Node_Str")) {
    intro=null;
  }
  String copy=request.getParameter("String_Node_Str");
  if (copy.equals("String_Node_Str")) {
    copy=null;
  }
  String side=request.getParameter("String_Node_Str");
  if (side.equals("String_Node_Str")) {
    side=null;
  }
  String license=request.getParameter("String_Node_Str");
  if (license.equals("String_Node_Str")) {
    license=null;
  }
  String provenance=request.getParameter("String_Node_Str");
  if (provenance.equals("String_Node_Str")) {
    provenance=null;
  }
  collection.setMetadata("String_Node_Str",intro);
  collection.setMetadata("String_Node_Str",copy);
  collection.setMetadata("String_Node_Str",side);
  collection.setMetadata("String_Node_Str",license);
  collection.setMetadata("String_Node_Str",provenance);
  String button=UIUtil.getSubmitButton(request,"String_Node_Str");
  if (button.equals("String_Node_Str")) {
    collection.setLogo(null);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    collection.setLogo(null);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.startsWith("String_Node_Str")) {
    int step=Integer.parseInt(button.substring(17));
    Group newGroup=Group.create(context);
    newGroup.setName("String_Node_Str" + collection.getID() + "String_Node_Str"+ step);
    newGroup.update();
    collection.setWorkflowGroup(step,newGroup);
    collection.update();
    response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "String_Node_Str" + newGroup.getID()));
  }
 else   if (button.startsWith("String_Node_Str")) {
    int step=Integer.parseInt(button.substring(15));
    Group g=collection.getWorkflowGroup(step);
    response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "String_Node_Str" + g.getID()));
  }
 else   if (button.startsWith("String_Node_Str")) {
    int step=Integer.parseInt(button.substring(17));
    Group g=collection.getWorkflowGroup(step);
    collection.setWorkflowGroup(step,null);
    collection.update();
    g.delete();
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    collection.createTemplateItem();
    Item i=collection.getTemplateItem();
    response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "String_Node_Str" + i.getID()));
  }
 else   if (button.equals("String_Node_Str")) {
    Item i=collection.getTemplateItem();
    response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "String_Node_Str" + i.getID()));
  }
 else   if (button.equals("String_Node_Str")) {
    collection.removeTemplateItem();
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else {
    showControls(context,request,response);
  }
  collection.update();
  context.complete();
}

Fixed version (ground truth):
/** 
 * Create/update collection metadata from a posted form
 * @param context     DSpace context
 * @param request     the HTTP request containing posted info
 * @param response    the HTTP response
 * @param community   the community the collection is in
 * @param collection  the collection to update (or null for creation)
 */
private void processConfirmEditCollection(Context context,HttpServletRequest request,HttpServletResponse response,Community community,Collection collection) throws ServletException, IOException, SQLException, AuthorizeException {
  if (request.getParameter("String_Node_Str").equals("String_Node_Str")) {
    collection=community.createCollection();
    request.setAttribute("String_Node_Str",collection);
  }
  collection.setMetadata("String_Node_Str",request.getParameter("String_Node_Str"));
  collection.setMetadata("String_Node_Str",request.getParameter("String_Node_Str"));
  String intro=request.getParameter("String_Node_Str");
  if (intro.equals("String_Node_Str")) {
    intro=null;
  }
  String copy=request.getParameter("String_Node_Str");
  if (copy.equals("String_Node_Str")) {
    copy=null;
  }
  String side=request.getParameter("String_Node_Str");
  if (side.equals("String_Node_Str")) {
    side=null;
  }
  String license=request.getParameter("String_Node_Str");
  if (license.equals("String_Node_Str")) {
    license=null;
  }
  String provenance=request.getParameter("String_Node_Str");
  if (provenance.equals("String_Node_Str")) {
    provenance=null;
  }
  collection.setMetadata("String_Node_Str",intro);
  collection.setMetadata("String_Node_Str",copy);
  collection.setMetadata("String_Node_Str",side);
  collection.setMetadata("String_Node_Str",license);
  collection.setMetadata("String_Node_Str",provenance);
  String button=UIUtil.getSubmitButton(request,"String_Node_Str");
  if (button.equals("String_Node_Str")) {
    collection.setLogo(null);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    collection.setLogo(null);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.startsWith("String_Node_Str")) {
    int step=Integer.parseInt(button.substring(17));
    Group newGroup=Group.create(context);
    newGroup.setName("String_Node_Str" + collection.getID() + "String_Node_Str"+ step);
    newGroup.update();
    collection.setWorkflowGroup(step,newGroup);
    collection.update();
    response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "String_Node_Str" + newGroup.getID()));
  }
 else   if (button.startsWith("String_Node_Str")) {
    int step=Integer.parseInt(button.substring(15));
    Group g=collection.getWorkflowGroup(step);
    response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "String_Node_Str" + g.getID()));
  }
 else   if (button.startsWith("String_Node_Str")) {
    int step=Integer.parseInt(button.substring(17));
    Group g=collection.getWorkflowGroup(step);
    collection.setWorkflowGroup(step,null);
    collection.update();
    g.delete();
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    collection.createTemplateItem();
    Item i=collection.getTemplateItem();
    collection.update();
    context.complete();
    response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "String_Node_Str" + i.getID()));
    return;
  }
 else   if (button.equals("String_Node_Str")) {
    Item i=collection.getTemplateItem();
    response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "String_Node_Str" + i.getID()));
  }
 else   if (button.equals("String_Node_Str")) {
    collection.removeTemplateItem();
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else {
    showControls(context,request,response);
  }
  collection.update();
  context.complete();
}