Program: 84502
Project: 84502
Buggy source:
/** 
 * The onSubmit function receives the form/command object that was modified by the input form and saves it to the db
 * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.Object,org.springframework.validation.BindException)
 * @should display numeric values from table
 * @should copy numeric values into numeric concepts
 * @should return a concept with a null id if no match is found
 */
@Override protected ModelAndView onSubmit(HttpServletRequest request,HttpServletResponse response,Object obj,BindException errors) throws Exception {
  HttpSession httpSession=request.getSession();
  ConceptService cs=Context.getConceptService();
  if (Context.isAuthenticated()) {
    ConceptFormBackingObject conceptBackingObject=(ConceptFormBackingObject)obj;
    MessageSourceAccessor msa=getMessageSourceAccessor();
    String action=request.getParameter("String_Node_Str");
    if (action.equals(msa.getMessage("String_Node_Str","String_Node_Str"))) {
      Concept concept=conceptBackingObject.getConcept();
      try {
        cs.purgeConcept(concept);
        httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR,"String_Node_Str");
        return new ModelAndView(new RedirectView("String_Node_Str"));
      }
 catch (      ConceptsLockedException cle) {
        log.error("String_Node_Str",cle);
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
      }
catch (      DataIntegrityViolationException e) {
        log.error("String_Node_Str" + concept,e);
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
      }
catch (      Exception e) {
        log.error("String_Node_Str" + concept,e);
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
      }
      return new ModelAndView(new RedirectView(getSuccessView() + "String_Node_Str" + concept.getConceptId()));
    }
 else {
      Concept concept=conceptBackingObject.getConceptFromFormData();
      if (concept.getConceptId() != null)       concept.getCreator().getPersonName();
      try {
        new ConceptValidator().validate(concept,errors);
        if (!errors.hasErrors()) {
          cs.saveConcept(concept);
          httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR,"String_Node_Str");
          return new ModelAndView(new RedirectView(getSuccessView() + "String_Node_Str" + concept.getConceptId()));
        }
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
      }
 catch (      ConceptsLockedException cle) {
        log.error("String_Node_Str",cle);
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
        errors.reject("String_Node_Str","String_Node_Str");
      }
catch (      DuplicateConceptNameException e) {
        log.error("String_Node_Str");
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
        errors.rejectValue("String_Node_Str","String_Node_Str");
      }
catch (      APIException e) {
        log.error("String_Node_Str",e);
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
        errors.reject("String_Node_Str","String_Node_Str");
      }
      return showForm(request,response,errors);
    }
  }
  return new ModelAndView(new RedirectView(getFormView()));
}

Fixed version (ground truth):
/** 
 * The onSubmit function receives the form/command object that was modified by the input form and saves it to the db
 * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.Object,org.springframework.validation.BindException)
 * @should display numeric values from table
 * @should copy numeric values into numeric concepts
 * @should return a concept with a null id if no match is found
 * @should void a synonym marked as preferred when it is removed
 * @should set the local preferred name
 */
@Override protected ModelAndView onSubmit(HttpServletRequest request,HttpServletResponse response,Object obj,BindException errors) throws Exception {
  HttpSession httpSession=request.getSession();
  ConceptService cs=Context.getConceptService();
  if (Context.isAuthenticated()) {
    ConceptFormBackingObject conceptBackingObject=(ConceptFormBackingObject)obj;
    MessageSourceAccessor msa=getMessageSourceAccessor();
    String action=request.getParameter("String_Node_Str");
    if (action.equals(msa.getMessage("String_Node_Str","String_Node_Str"))) {
      Concept concept=conceptBackingObject.getConcept();
      try {
        cs.purgeConcept(concept);
        httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR,"String_Node_Str");
        return new ModelAndView(new RedirectView("String_Node_Str"));
      }
 catch (      ConceptsLockedException cle) {
        log.error("String_Node_Str",cle);
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
      }
catch (      DataIntegrityViolationException e) {
        log.error("String_Node_Str" + concept,e);
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
      }
catch (      Exception e) {
        log.error("String_Node_Str" + concept,e);
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
      }
      return new ModelAndView(new RedirectView(getSuccessView() + "String_Node_Str" + concept.getConceptId()));
    }
 else {
      Concept concept=conceptBackingObject.getConceptFromFormData();
      if (concept.getConceptId() != null)       concept.getCreator().getPersonName();
      try {
        new ConceptValidator().validate(concept,errors);
        if (!errors.hasErrors()) {
          cs.saveConcept(concept);
          httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR,"String_Node_Str");
          return new ModelAndView(new RedirectView(getSuccessView() + "String_Node_Str" + concept.getConceptId()));
        }
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
      }
 catch (      ConceptsLockedException cle) {
        log.error("String_Node_Str",cle);
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
        errors.reject("String_Node_Str","String_Node_Str");
      }
catch (      DuplicateConceptNameException e) {
        log.error("String_Node_Str",e);
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
        errors.rejectValue("String_Node_Str","String_Node_Str");
      }
catch (      APIException e) {
        log.error("String_Node_Str",e);
        httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR,"String_Node_Str");
        errors.reject("String_Node_Str","String_Node_Str");
      }
      return showForm(request,response,errors);
    }
  }
  return new ModelAndView(new RedirectView(getFormView()));
}