Program: 3667
Project: 3667
Buggy source:
/** 
 * Fill out an item's DC values from a plain standard text field. If the field isn't repeatable, the input field name is called: element_qualifier or for an unqualified element: element Repeated elements are appended with an underscore then an integer. e.g.: title_alternative_0 title_alternative_1 The values will be put in separate DCValues, ordered as they appear in the list.  These will replace any existing values.
 * @param request    the request object
 * @param item       the item to update
 * @param element    the DC element
 * @param qualifier  the DC qualifier, or null if unqualified
 * @param repeated   set to true if the field is repeatable on the form
 * @param lang       language to set (ISO code)
 */
private void readText(HttpServletRequest request,Item item,String element,String qualifier,boolean repeated,String lang){
  String dcname=element;
  if (qualifier != null) {
    dcname=element + "String_Node_Str" + qualifier;
  }
  List vals=new LinkedList();
  if (repeated) {
    vals=getRepeatedParameter(request,dcname);
    String buttonPressed=UIUtil.getSubmitButton(request,"String_Node_Str");
    String removeButton="String_Node_Str" + dcname + "String_Node_Str";
    if (buttonPressed.startsWith(removeButton)) {
      int valToRemove=Integer.parseInt(buttonPressed.substring(removeButton.length()));
      vals.remove(valToRemove);
    }
  }
 else {
    String s=request.getParameter(dcname);
    if (s != null && !s.equals("String_Node_Str")) {
      vals.add(s);
    }
  }
  item.clearDC(element,qualifier,Item.ANY);
  for (int i=0; i < vals.size(); i++) {
    item.addDC(element,qualifier,lang,(String)vals.get(i));
  }
}

Fixed version (ground truth):
/** 
 * Fill out an item's DC values from a plain standard text field. If the field isn't repeatable, the input field name is called: element_qualifier or for an unqualified element: element Repeated elements are appended with an underscore then an integer. e.g.: title_alternative_0 title_alternative_1 The values will be put in separate DCValues, ordered as they appear in the list.  These will replace any existing values.
 * @param request    the request object
 * @param item       the item to update
 * @param element    the DC element
 * @param qualifier  the DC qualifier, or null if unqualified
 * @param repeated   set to true if the field is repeatable on the form
 * @param lang       language to set (ISO code)
 */
private void readText(HttpServletRequest request,Item item,String element,String qualifier,boolean repeated,String lang){
  String dcname=element;
  if (qualifier != null) {
    dcname=element + "String_Node_Str" + qualifier;
  }
  List vals=new LinkedList();
  if (repeated) {
    vals=getRepeatedParameter(request,dcname);
    String buttonPressed=UIUtil.getSubmitButton(request,"String_Node_Str");
    String removeButton="String_Node_Str" + dcname + "String_Node_Str";
    if (buttonPressed.startsWith(removeButton)) {
      int valToRemove=Integer.parseInt(buttonPressed.substring(removeButton.length()));
      vals.remove(valToRemove);
    }
  }
 else {
    String s=request.getParameter(dcname);
  }
  item.clearDC(element,qualifier,Item.ANY);
  for (int i=0; i < vals.size(); i++) {
    String s=(String)vals.get(i);
    if (s != null && !s.trim().equals("String_Node_Str")) {
      item.addDC(element,qualifier,lang,s);
    }
  }
}