Program: 3278
Project: 3278
Buggy source:
/** 
 * Render a date field to the DRI document. The date field consists of three component fields, a 4 character text field for the year, a select box for the month, and a 2 character text field for the day.
 * @param form The form list to add the field too
 * @param fieldName The field's name.
 * @param dcInput The field's input deffinition
 * @param dcValues The field's pre-existing values.
 */
private void renderDateField(List form,String fieldName,DCInput dcInput,DCValue[] dcValues,boolean readonly) throws WingException {
  Composite fullDate=form.addItem().addComposite(fieldName,"String_Node_Str");
  Text year=fullDate.addText(fieldName + "String_Node_Str");
  Select month=fullDate.addSelect(fieldName + "String_Node_Str");
  Text day=fullDate.addText(fieldName + "String_Node_Str");
  fullDate.setLabel(dcInput.getLabel());
  fullDate.setHelp(cleanHints(dcInput.getHints()));
  if (dcInput.isRequired())   fullDate.setRequired();
  if (isFieldInError(fieldName))   fullDate.addError(T_required_field);
  if (dcInput.isRepeatable() && !readonly)   fullDate.enableAddOperation();
  if ((dcInput.isRepeatable() || dcValues.length > 1) && !readonly)   fullDate.enableDeleteOperation();
  if (readonly) {
    year.setDisabled();
    month.setDisabled();
    day.setDisabled();
  }
  year.setLabel(T_year);
  year.setSize(4,4);
  month.setLabel(T_month);
  month.addOption(0,"String_Node_Str");
  for (int i=1; i < 13; i++) {
    month.addOption(i,org.dspace.content.DCDate.getMonthName(i,Locale.getDefault()));
  }
  day.setLabel(T_day);
  day.setSize(2,2);
  if (dcInput.isRepeatable() || dcValues.length > 1) {
    for (    DCValue dcValue : dcValues) {
      DCDate dcDate=new DCDate(dcValue.value);
      year.addInstance().setValue(String.valueOf(dcDate.getYearGMT()));
      month.addInstance().setOptionSelected(dcDate.getMonthGMT());
      day.addInstance().setValue(String.valueOf(dcDate.getDayGMT()));
      fullDate.addInstance().setValue(dcDate.toString());
    }
  }
 else   if (dcValues.length == 1) {
    DCDate dcDate=new DCDate(dcValues[0].value);
    year.setValue(String.valueOf(dcDate.getYearGMT()));
    month.setOptionSelected(dcDate.getMonthGMT());
    if (dcDate.getDayGMT() == -1)     day.setValue("String_Node_Str");
 else     day.setValue(String.valueOf(dcDate.getDayGMT()));
  }
}

Fixed version (ground truth):
/** 
 * Render a date field to the DRI document. The date field consists of three component fields, a 4 character text field for the year, a select box for the month, and a 2 character text field for the day.
 * @param form The form list to add the field too
 * @param fieldName The field's name.
 * @param dcInput The field's input deffinition
 * @param dcValues The field's pre-existing values.
 */
private void renderDateField(List form,String fieldName,DCInput dcInput,DCValue[] dcValues,boolean readonly) throws WingException {
  Composite fullDate=form.addItem().addComposite(fieldName,"String_Node_Str");
  Text year=fullDate.addText(fieldName + "String_Node_Str");
  Select month=fullDate.addSelect(fieldName + "String_Node_Str");
  Text day=fullDate.addText(fieldName + "String_Node_Str");
  fullDate.setLabel(dcInput.getLabel());
  fullDate.setHelp(cleanHints(dcInput.getHints()));
  if (dcInput.isRequired())   fullDate.setRequired();
  if (isFieldInError(fieldName))   fullDate.addError(T_required_field);
  if (dcInput.isRepeatable() && !readonly)   fullDate.enableAddOperation();
  if ((dcInput.isRepeatable() || dcValues.length > 1) && !readonly)   fullDate.enableDeleteOperation();
  if (readonly) {
    year.setDisabled();
    month.setDisabled();
    day.setDisabled();
  }
  year.setLabel(T_year);
  year.setSize(4,4);
  month.setLabel(T_month);
  month.addOption(0,"String_Node_Str");
  for (int i=1; i < 13; i++) {
    month.addOption(i,org.dspace.content.DCDate.getMonthName(i,Locale.getDefault()));
  }
  day.setLabel(T_day);
  day.setSize(2,2);
  if (dcInput.isRepeatable() || dcValues.length > 1) {
    for (    DCValue dcValue : dcValues) {
      DCDate dcDate=new DCDate(dcValue.value);
      year.addInstance().setValue(String.valueOf(dcDate.getYear()));
      month.addInstance().setOptionSelected(dcDate.getMonth());
      day.addInstance().setValue(String.valueOf(dcDate.getDay()));
      fullDate.addInstance().setValue(dcDate.toString());
    }
  }
 else   if (dcValues.length == 1) {
    DCDate dcDate=new DCDate(dcValues[0].value);
    year.setValue(String.valueOf(dcDate.getYear()));
    month.setOptionSelected(dcDate.getMonth());
    if (dcDate.getDay() == -1)     day.setValue("String_Node_Str");
 else     day.setValue(String.valueOf(dcDate.getDay()));
  }
}