Program: 84578
Project: 84578
Buggy source:
protected ModelAndView processFormSubmission(HttpServletRequest request,HttpServletResponse response,Object obj,BindException errors) throws Exception {
  newIdentifiers=new HashSet<PatientIdentifier>();
  ShortPatientModel shortPatient=(ShortPatientModel)obj;
  log.debug("String_Node_Str");
  if (Context.isAuthenticated()) {
    PatientService ps=Context.getPatientService();
    MessageSourceAccessor msa=getMessageSourceAccessor();
    String action=request.getParameter("String_Node_Str");
    if (action == null || action.equals(msa.getMessage("String_Node_Str"))) {
      ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
      String[] identifiers=request.getParameterValues("String_Node_Str");
      String[] types=request.getParameterValues("String_Node_Str");
      String[] locs=request.getParameterValues("String_Node_Str");
      pref=request.getParameter("String_Node_Str");
      if (pref == null)       pref="String_Node_Str";
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + identifiers);
        for (        String s : identifiers)         log.debug(s);
        log.debug("String_Node_Str" + types);
        for (        String s : types)         log.debug(s);
        log.debug("String_Node_Str" + locs);
        for (        String s : locs)         log.debug(s);
        log.debug("String_Node_Str" + pref);
      }
      if (identifiers != null) {
        for (int i=0; i < identifiers.length; i++) {
          String id=identifiers[i].trim();
          String[] args={id};
          if (id.length() > 0) {
            PatientIdentifierType pit=null;
            if (types[i] == null || types[i].equals("String_Node_Str")) {
              String msg=getMessageSourceAccessor().getMessage("String_Node_Str",args);
              errors.reject(msg);
            }
 else             pit=ps.getPatientIdentifierType(Integer.valueOf(types[i]));
            Location loc=null;
            if (locs[i] == null || locs[i].equals("String_Node_Str")) {
              String msg=getMessageSourceAccessor().getMessage("String_Node_Str",args);
              errors.reject(msg);
            }
 else             loc=Context.getLocationService().getLocation(Integer.valueOf(locs[i]));
            PatientIdentifier pi=new PatientIdentifier(id,pit,loc);
            pi.setPreferred(pref.equals(id + types[i]));
            if (newIdentifiers.contains(pi))             newIdentifiers.remove(pi);
            newIdentifiers.add(pi);
            if (log.isDebugEnabled()) {
              log.debug("String_Node_Str" + id);
              log.debug("String_Node_Str" + types[i]);
              log.debug("String_Node_Str" + locs[i]);
            }
          }
        }
      }
    }
    ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
    if (shortPatient.getBirthdate() != null) {
      if (shortPatient.getBirthdate().after(new Date()))       errors.rejectValue("String_Node_Str","String_Node_Str");
 else {
        Calendar c=Calendar.getInstance();
        c.setTime(new Date());
        c.add(Calendar.YEAR,-120);
        if (shortPatient.getBirthdate().before(c.getTime())) {
          errors.rejectValue("String_Node_Str","String_Node_Str");
        }
      }
    }
  }
  return super.processFormSubmission(request,response,shortPatient,errors);
}

Fixed version (ground truth):
protected ModelAndView processFormSubmission(HttpServletRequest request,HttpServletResponse response,Object obj,BindException errors) throws Exception {
  newIdentifiers=new HashSet<PatientIdentifier>();
  ShortPatientModel shortPatient=(ShortPatientModel)obj;
  log.debug("String_Node_Str");
  if (Context.isAuthenticated()) {
    PatientService ps=Context.getPatientService();
    MessageSourceAccessor msa=getMessageSourceAccessor();
    String action=request.getParameter("String_Node_Str");
    if (action == null || action.equals(msa.getMessage("String_Node_Str"))) {
      ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
      String[] identifiers=request.getParameterValues("String_Node_Str");
      String[] types=request.getParameterValues("String_Node_Str");
      String[] locs=request.getParameterValues("String_Node_Str");
      pref=request.getParameter("String_Node_Str");
      if (pref == null)       pref="String_Node_Str";
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + identifiers);
        for (        String s : identifiers)         log.debug(s);
        log.debug("String_Node_Str" + types);
        for (        String s : types)         log.debug(s);
        log.debug("String_Node_Str" + locs);
        for (        String s : locs)         log.debug(s);
        log.debug("String_Node_Str" + pref);
      }
      if (identifiers != null) {
        for (int i=0; i < identifiers.length; i++) {
          String id=identifiers[i].trim();
          String[] args={id};
          if (id.length() > 0) {
            PatientIdentifierType pit=null;
            if (types[i] == null || types[i].equals("String_Node_Str")) {
              String msg=getMessageSourceAccessor().getMessage("String_Node_Str",args);
              errors.reject(msg);
            }
 else             pit=ps.getPatientIdentifierType(Integer.valueOf(types[i]));
            Location loc=null;
            if (locs[i] == null || locs[i].equals("String_Node_Str")) {
              String msg=getMessageSourceAccessor().getMessage("String_Node_Str",args);
              errors.reject(msg);
            }
 else             loc=Context.getLocationService().getLocation(Integer.valueOf(locs[i]));
            PatientIdentifier pi=new PatientIdentifier(id,pit,loc);
            pi.setPreferred(pref.equals(id + types[i]));
            if (newIdentifiers.contains(pi))             newIdentifiers.remove(pi);
            newIdentifiers.add(pi);
            if (log.isDebugEnabled()) {
              log.debug("String_Node_Str" + id);
              log.debug("String_Node_Str" + types[i]);
              log.debug("String_Node_Str" + locs[i]);
            }
          }
        }
      }
    }
    ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
    if (shortPatient.getBirthdate() != null) {
      if (shortPatient.getBirthdate().after(new Date()))       errors.rejectValue("String_Node_Str","String_Node_Str");
 else {
        Calendar c=Calendar.getInstance();
        c.setTime(new Date());
        c.add(Calendar.YEAR,-120);
        if (shortPatient.getBirthdate().before(c.getTime())) {
          errors.rejectValue("String_Node_Str","String_Node_Str");
        }
      }
    }
  }
  return onSubmit(request,response,shortPatient,errors);
}