Program: 84582
Project: 84582
Buggy source:
/** 
 * Called prior to form display.  Allows for data to be put  in the request to be used in the view
 * @see org.springframework.web.servlet.mvc.SimpleFormController#referenceData(javax.servlet.http.HttpServletRequest)
 */
protected Map referenceData(HttpServletRequest request) throws Exception {
  Locale locale=Context.getLocale();
  Map<String,Object> map=new HashMap<String,Object>();
  String defaultVerbose="String_Node_Str";
  ConceptService cs=Context.getConceptService();
  String conceptId=request.getParameter("String_Node_Str");
  ConceptName conceptName=new ConceptName();
  Collection<ConceptSynonym> conceptSynonyms=new Vector<ConceptSynonym>();
  Map<String,ConceptName> conceptNamesByLocale=new HashMap<String,ConceptName>();
  Map<Locale,Collection<ConceptSynonym>> conceptSynonymsByLocale=new HashMap<Locale,Collection<ConceptSynonym>>();
  Map<Double,Object[]> conceptSets=new TreeMap<Double,Object[]>();
  Map<String,String> conceptAnswers=new TreeMap<String,String>();
  Collection<Form> forms=new HashSet<Form>();
  Map<Integer,String> questionsAnswered=new TreeMap<Integer,String>();
  Map<Integer,String> containedInSets=new TreeMap<Integer,String>();
  boolean isNew=true;
  if (conceptId != null) {
    Concept concept=cs.getConcept(Integer.valueOf(conceptId));
    if (concept != null) {
      isNew=false;
      for (      Locale l : OPENMRS_CONCEPT_LOCALES()) {
        ConceptName cn=concept.getName(l,true);
        if (cn == null) {
          cn=new ConceptName();
        }
        conceptNamesByLocale.put(l.toString(),cn);
      }
      for (      Locale l : OPENMRS_CONCEPT_LOCALES()) {
        conceptSynonymsByLocale.put(l,concept.getSynonyms(l));
      }
      conceptName=concept.getName(locale);
      if (conceptName == null)       conceptName=new ConceptName();
      conceptSynonyms=concept.getSynonyms(locale);
      for (      ConceptSet set : concept.getConceptSets()) {
        Object[] arr={set.getConcept().getConceptId().toString(),set.getConcept().getName(locale)};
        conceptSets.put(set.getSortWeight(),arr);
      }
      for (      ConceptAnswer answer : concept.getAnswers(true)) {
        log.debug("String_Node_Str");
        String key=answer.getAnswerConcept().getConceptId().toString();
        ConceptName cn=answer.getAnswerConcept().getName(locale);
        String name="String_Node_Str";
        if (cn != null)         name=cn.toString();
        if (answer.getAnswerDrug() != null) {
          key=key + "String_Node_Str" + answer.getAnswerDrug().getDrugId();
          name=answer.getAnswerDrug().getFullName(locale);
        }
        if (answer.getAnswerConcept().isRetired())         name="String_Node_Str" + name + "String_Node_Str";
        conceptAnswers.put(key,name);
      }
      forms=Context.getFormService().getForms(concept);
      for (      Concept c : Context.getConceptService().getQuestionsForAnswer(concept)) {
        ConceptName cn=c.getName(locale);
        if (cn == null)         questionsAnswered.put(c.getConceptId(),"String_Node_Str");
 else         questionsAnswered.put(c.getConceptId(),cn.getName());
      }
      for (      ConceptSet set : Context.getConceptService().getSetsContainingConcept(concept)) {
        Concept c=set.getConceptSet();
        ConceptName cn=c.getName(locale);
        if (cn == null)         containedInSets.put(c.getConceptId(),"String_Node_Str");
 else         containedInSets.put(c.getConceptId(),cn.getName());
      }
    }
    if (Context.isAuthenticated())     defaultVerbose=Context.getAuthenticatedUser().getUserProperty(OpenmrsConstants.USER_PROPERTY_SHOW_VERBOSE);
  }
  if (isNew) {
    for (    Locale l : OPENMRS_CONCEPT_LOCALES()) {
      conceptNamesByLocale.put(l.toString(),new ConceptName());
    }
    for (    Locale l : OPENMRS_CONCEPT_LOCALES()) {
      conceptSynonymsByLocale.put(l,new HashSet<ConceptSynonym>());
    }
  }
  map.put("String_Node_Str",OPENMRS_CONCEPT_LOCALES());
  map.put("String_Node_Str",conceptName);
  for (  Map.Entry<String,ConceptName> e : conceptNamesByLocale.entrySet()) {
    map.put("String_Node_Str" + e.getKey(),e.getValue());
  }
  map.put("String_Node_Str",conceptSynonyms);
  map.put("String_Node_Str",conceptSynonymsByLocale);
  map.put("String_Node_Str",conceptSets);
  map.put("String_Node_Str",conceptAnswers);
  map.put("String_Node_Str",forms);
  map.put("String_Node_Str",questionsAnswered);
  map.put("String_Node_Str",containedInSets);
  map.put("String_Node_Str",cs.getConceptClasses());
  map.put("String_Node_Str",cs.getAllConceptDatatypes());
  map.put("String_Node_Str",locale.getLanguage().substring(0,2));
  map.put("String_Node_Str",defaultVerbose.equals("String_Node_Str") ? true : false);
  return map;
}

Fixed version (ground truth):
/** 
 * Called prior to form display.  Allows for data to be put  in the request to be used in the view
 * @see org.springframework.web.servlet.mvc.SimpleFormController#referenceData(javax.servlet.http.HttpServletRequest)
 */
protected Map<String,Object> referenceData(HttpServletRequest request) throws Exception {
  Locale locale=Context.getLocale();
  Map<String,Object> map=new HashMap<String,Object>();
  String defaultVerbose="String_Node_Str";
  ConceptService cs=Context.getConceptService();
  String conceptId=request.getParameter("String_Node_Str");
  ConceptName conceptName=new ConceptName();
  Collection<ConceptSynonym> conceptSynonyms=new Vector<ConceptSynonym>();
  Map<String,ConceptName> conceptNamesByLocale=new HashMap<String,ConceptName>();
  Map<Locale,Collection<ConceptSynonym>> conceptSynonymsByLocale=new HashMap<Locale,Collection<ConceptSynonym>>();
  Map<Double,Object[]> conceptSets=new TreeMap<Double,Object[]>();
  Map<String,String> conceptAnswers=new TreeMap<String,String>();
  Collection<Form> forms=new HashSet<Form>();
  Map<Integer,String> questionsAnswered=new TreeMap<Integer,String>();
  Map<Integer,String> containedInSets=new TreeMap<Integer,String>();
  boolean isNew=true;
  if (conceptId != null) {
    Concept concept=cs.getConcept(Integer.valueOf(conceptId));
    if (concept != null) {
      isNew=false;
      for (      Locale l : OPENMRS_CONCEPT_LOCALES()) {
        ConceptName cn=concept.getName(l,true);
        if (cn == null) {
          cn=new ConceptName();
        }
        conceptNamesByLocale.put(l.toString(),cn);
      }
      for (      Locale l : OPENMRS_CONCEPT_LOCALES()) {
        conceptSynonymsByLocale.put(l,concept.getSynonyms(l));
      }
      conceptName=concept.getName(locale);
      if (conceptName == null)       conceptName=new ConceptName();
      conceptSynonyms=concept.getSynonyms(locale);
      for (      ConceptSet set : concept.getConceptSets()) {
        Object[] arr={set.getConcept().getConceptId().toString(),set.getConcept().getName(locale)};
        conceptSets.put(set.getSortWeight(),arr);
      }
      for (      ConceptAnswer answer : concept.getAnswers(true)) {
        log.debug("String_Node_Str");
        String key=answer.getAnswerConcept().getConceptId().toString();
        ConceptName cn=answer.getAnswerConcept().getName(locale);
        String name="String_Node_Str";
        if (cn != null)         name=cn.toString();
        if (answer.getAnswerDrug() != null) {
          key=key + "String_Node_Str" + answer.getAnswerDrug().getDrugId();
          name=answer.getAnswerDrug().getFullName(locale);
        }
        if (answer.getAnswerConcept().isRetired())         name="String_Node_Str" + name + "String_Node_Str";
        conceptAnswers.put(key,name);
      }
      forms=Context.getFormService().getFormsContainingConcept(concept);
      for (      Concept c : Context.getConceptService().getConceptsByAnswer(concept)) {
        ConceptName cn=c.getName(locale);
        if (cn == null)         questionsAnswered.put(c.getConceptId(),"String_Node_Str");
 else         questionsAnswered.put(c.getConceptId(),cn.getName());
      }
      for (      ConceptSet set : Context.getConceptService().getSetsContainingConcept(concept)) {
        Concept c=set.getConceptSet();
        ConceptName cn=c.getName(locale);
        if (cn == null)         containedInSets.put(c.getConceptId(),"String_Node_Str");
 else         containedInSets.put(c.getConceptId(),cn.getName());
      }
    }
    if (Context.isAuthenticated())     defaultVerbose=Context.getAuthenticatedUser().getUserProperty(OpenmrsConstants.USER_PROPERTY_SHOW_VERBOSE);
  }
  if (isNew) {
    for (    Locale l : OPENMRS_CONCEPT_LOCALES()) {
      conceptNamesByLocale.put(l.toString(),new ConceptName());
    }
    for (    Locale l : OPENMRS_CONCEPT_LOCALES()) {
      conceptSynonymsByLocale.put(l,new HashSet<ConceptSynonym>());
    }
  }
  map.put("String_Node_Str",OPENMRS_CONCEPT_LOCALES());
  map.put("String_Node_Str",conceptName);
  for (  Map.Entry<String,ConceptName> e : conceptNamesByLocale.entrySet()) {
    map.put("String_Node_Str" + e.getKey(),e.getValue());
  }
  map.put("String_Node_Str",conceptSynonyms);
  map.put("String_Node_Str",conceptSynonymsByLocale);
  map.put("String_Node_Str",conceptSets);
  map.put("String_Node_Str",conceptAnswers);
  map.put("String_Node_Str",forms);
  map.put("String_Node_Str",questionsAnswered);
  map.put("String_Node_Str",containedInSets);
  map.put("String_Node_Str",cs.getAllConceptClasses());
  map.put("String_Node_Str",cs.getAllConceptDatatypes());
  map.put("String_Node_Str",locale.getLanguage().substring(0,2));
  map.put("String_Node_Str",defaultVerbose.equals("String_Node_Str") ? true : false);
  return map;
}