Program: 23159
Project: 23159
Buggy source:
private boolean addDefineRowToTable(XhtmlNode t,ConceptDefinitionComponent c,int i,boolean hasHierarchy,boolean hasDisplay,boolean comment,boolean version,boolean deprecated,List<UsedConceptMap> maps,String system,CodeSystem cs,String lang){
  boolean hasExtensions=false;
  XhtmlNode tr=t.tr();
  XhtmlNode td=tr.td();
  if (hasHierarchy) {
    td.addText(Integer.toString(i + 1));
    td=tr.td();
    String s=Utilities.padLeft("String_Node_Str",'\u00A0',i * 2);
    td.addText(s);
  }
  td.addText(c.getCode());
  XhtmlNode a;
  if (c.hasCodeElement()) {
    td.an(cs.getId() + "String_Node_Str" + Utilities.nmtokenize(c.getCode()));
  }
  if (hasDisplay) {
    td=tr.td();
    if (c.hasDisplayElement()) {
      if (lang == null) {
        td.addText(c.getDisplay());
      }
 else       if (lang.equals("String_Node_Str")) {
        boolean sl=false;
        for (        ConceptDefinitionDesignationComponent cd : c.getDesignation())         if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && !c.getDisplay().equalsIgnoreCase(cd.getValue()))         sl=true;
        td.addText((sl ? cs.getLanguage("String_Node_Str") + "String_Node_Str" : "String_Node_Str") + c.getDisplay());
        for (        ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
          if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && !c.getDisplay().equalsIgnoreCase(cd.getValue())) {
            td.br();
            td.addText(cd.getLanguage() + "String_Node_Str" + cd.getValue());
          }
        }
      }
 else       if (lang.equals(cs.getLanguage()) || (lang.equals("String_Node_Str") && !cs.hasLanguage())) {
        td.addText(c.getDisplay());
      }
 else {
        for (        ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
          if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && cd.getLanguage().equals(lang)) {
            td.addText(cd.getValue());
          }
        }
      }
    }
  }
  td=tr.td();
  if (c != null && c.hasDefinitionElement()) {
    if (lang == null) {
      td.addText(c.getDefinition());
    }
 else     if (lang.equals("String_Node_Str")) {
      boolean sl=false;
      for (      ConceptDefinitionDesignationComponent cd : c.getDesignation())       if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && !c.getDefinition().equalsIgnoreCase(cd.getValue()))       sl=true;
      td.addText((sl ? cs.getLanguage("String_Node_Str") + "String_Node_Str" : "String_Node_Str") + c.getDefinition());
      for (      ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
        if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && !c.getDefinition().equalsIgnoreCase(cd.getValue())) {
          td.br();
          td.addText(cd.getLanguage() + "String_Node_Str" + cd.getValue());
        }
      }
    }
 else     if (lang.equals(cs.getLanguage()) || (lang.equals("String_Node_Str") && !cs.hasLanguage())) {
      td.addText(c.getDefinition());
    }
 else {
      for (      ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
        if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && cd.getLanguage().equals(lang)) {
          td.addText(cd.getValue());
        }
      }
    }
  }
  if (deprecated) {
    td=tr.td();
    Boolean b=CodeSystemUtilities.isDeprecated(cs,c);
    if (b != null && b) {
      smartAddText(td,context.translator().translate("String_Node_Str","String_Node_Str",lang));
      hasExtensions=true;
      if (ToolingExtensions.hasExtension(c,ToolingExtensions.EXT_REPLACED_BY)) {
        Coding cc=(Coding)ToolingExtensions.getExtension(c,ToolingExtensions.EXT_REPLACED_BY).getValue();
        td.tx("String_Node_Str");
        String url=getCodingReference(cc,system);
        if (url != null) {
          td.ah(url).addText(cc.getCode());
          td.tx("String_Node_Str" + cc.getDisplay() + "String_Node_Str");
        }
 else         td.addText(cc.getCode() + "String_Node_Str" + cc.getDisplay()+ "String_Node_Str"+ cc.getSystem()+ "String_Node_Str");
      }
    }
  }
  if (comment) {
    td=tr.td();
    Extension ext=c.getExtensionByUrl(ToolingExtensions.EXT_CS_COMMENT);
    if (ext != null) {
      hasExtensions=true;
      String bc=ext.hasValue() ? ext.getValue().primitiveValue() : null;
      Map<String,String> translations=ToolingExtensions.getLanguageTranslations(ext.getValue());
      if (lang == null) {
        if (bc != null)         td.addText(bc);
      }
 else       if (lang.equals("String_Node_Str")) {
        boolean sl=false;
        for (        String l : translations.keySet())         if (bc == null || !bc.equalsIgnoreCase(translations.get(l)))         sl=true;
        if (bc != null) {
          td.addText((sl ? cs.getLanguage("String_Node_Str") : "String_Node_Str") + bc);
        }
        for (        String l : translations.keySet()) {
          if (bc == null || !bc.equalsIgnoreCase(translations.get(l))) {
            if (!td.getChildNodes().isEmpty())             td.br();
            td.addText(l + "String_Node_Str" + translations.get(l));
          }
        }
      }
 else       if (lang.equals(cs.getLanguage()) || (lang.equals("String_Node_Str") && !cs.hasLanguage())) {
        if (bc != null)         td.addText(bc);
      }
 else {
        if (bc != null)         translations.put(cs.getLanguage("String_Node_Str"),bc);
        for (        String l : translations.keySet()) {
          if (l.equals(lang)) {
            td.addText(translations.get(l));
          }
        }
      }
    }
  }
  if (version) {
    td=tr.td();
    if (c.hasUserData("String_Node_Str"))     td.addText(c.getUserString("String_Node_Str"));
  }
  for (  UsedConceptMap m : maps) {
    td=tr.td();
    List<TargetElementComponentWrapper> mappings=findMappingsForCode(c.getCode(),m.getMap());
    boolean first=true;
    for (    TargetElementComponentWrapper mapping : mappings) {
      if (!first)       td.br();
      first=false;
      XhtmlNode span=td.span(null,mapping.comp.hasEquivalence() ? mapping.comp.getEquivalence().toCode() : "String_Node_Str");
      span.addText(getCharForEquivalence(mapping.comp));
      a=td.ah(prefix + m.getLink() + "String_Node_Str"+ makeAnchor(mapping.group.getTarget(),mapping.comp.getCode()));
      a.addText(mapping.comp.getCode());
      if (!Utilities.noString(mapping.comp.getComment()))       td.i().tx("String_Node_Str" + mapping.comp.getComment() + "String_Node_Str");
    }
  }
  for (  CodeType e : ToolingExtensions.getSubsumes(c)) {
    hasExtensions=true;
    tr=t.tr();
    td=tr.td();
    String s=Utilities.padLeft("String_Node_Str",'.',i * 2);
    td.addText(s);
    a=td.ah("String_Node_Str" + Utilities.nmtokenize(e.getValue()));
    a.addText(c.getCode());
  }
  for (  ConceptDefinitionComponent cc : c.getConcept()) {
    hasExtensions=addDefineRowToTable(t,cc,i + 1,hasHierarchy,hasDisplay,comment,version,deprecated,maps,system,cs,lang) || hasExtensions;
  }
  return hasExtensions;
}

Fixed version (ground truth):
private boolean addDefineRowToTable(XhtmlNode t,ConceptDefinitionComponent c,int i,boolean hasHierarchy,boolean hasDisplay,boolean comment,boolean version,boolean deprecated,List<UsedConceptMap> maps,String system,CodeSystem cs,String lang){
  boolean hasExtensions=false;
  XhtmlNode tr=t.tr();
  XhtmlNode td=tr.td();
  if (hasHierarchy) {
    td.addText(Integer.toString(i + 1));
    td=tr.td();
    String s=Utilities.padLeft("String_Node_Str",'\u00A0',i * 2);
    td.addText(s);
  }
  td.attribute("String_Node_Str","String_Node_Str").addText(c.getCode());
  XhtmlNode a;
  if (c.hasCodeElement()) {
    td.an(cs.getId() + "String_Node_Str" + Utilities.nmtokenize(c.getCode()));
  }
  if (hasDisplay) {
    td=tr.td();
    if (c.hasDisplayElement()) {
      if (lang == null) {
        td.addText(c.getDisplay());
      }
 else       if (lang.equals("String_Node_Str")) {
        boolean sl=false;
        for (        ConceptDefinitionDesignationComponent cd : c.getDesignation())         if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && !c.getDisplay().equalsIgnoreCase(cd.getValue()))         sl=true;
        td.addText((sl ? cs.getLanguage("String_Node_Str") + "String_Node_Str" : "String_Node_Str") + c.getDisplay());
        for (        ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
          if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && !c.getDisplay().equalsIgnoreCase(cd.getValue())) {
            td.br();
            td.addText(cd.getLanguage() + "String_Node_Str" + cd.getValue());
          }
        }
      }
 else       if (lang.equals(cs.getLanguage()) || (lang.equals("String_Node_Str") && !cs.hasLanguage())) {
        td.addText(c.getDisplay());
      }
 else {
        for (        ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
          if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && cd.getLanguage().equals(lang)) {
            td.addText(cd.getValue());
          }
        }
      }
    }
  }
  td=tr.td();
  if (c != null && c.hasDefinitionElement()) {
    if (lang == null) {
      td.addText(c.getDefinition());
    }
 else     if (lang.equals("String_Node_Str")) {
      boolean sl=false;
      for (      ConceptDefinitionDesignationComponent cd : c.getDesignation())       if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && !c.getDefinition().equalsIgnoreCase(cd.getValue()))       sl=true;
      td.addText((sl ? cs.getLanguage("String_Node_Str") + "String_Node_Str" : "String_Node_Str") + c.getDefinition());
      for (      ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
        if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && !c.getDefinition().equalsIgnoreCase(cd.getValue())) {
          td.br();
          td.addText(cd.getLanguage() + "String_Node_Str" + cd.getValue());
        }
      }
    }
 else     if (lang.equals(cs.getLanguage()) || (lang.equals("String_Node_Str") && !cs.hasLanguage())) {
      td.addText(c.getDefinition());
    }
 else {
      for (      ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
        if (cd.getUse().is("String_Node_Str","String_Node_Str") && cd.hasLanguage() && cd.getLanguage().equals(lang)) {
          td.addText(cd.getValue());
        }
      }
    }
  }
  if (deprecated) {
    td=tr.td();
    Boolean b=CodeSystemUtilities.isDeprecated(cs,c);
    if (b != null && b) {
      smartAddText(td,context.translator().translate("String_Node_Str","String_Node_Str",lang));
      hasExtensions=true;
      if (ToolingExtensions.hasExtension(c,ToolingExtensions.EXT_REPLACED_BY)) {
        Coding cc=(Coding)ToolingExtensions.getExtension(c,ToolingExtensions.EXT_REPLACED_BY).getValue();
        td.tx("String_Node_Str");
        String url=getCodingReference(cc,system);
        if (url != null) {
          td.ah(url).addText(cc.getCode());
          td.tx("String_Node_Str" + cc.getDisplay() + "String_Node_Str");
        }
 else         td.addText(cc.getCode() + "String_Node_Str" + cc.getDisplay()+ "String_Node_Str"+ cc.getSystem()+ "String_Node_Str");
      }
    }
  }
  if (comment) {
    td=tr.td();
    Extension ext=c.getExtensionByUrl(ToolingExtensions.EXT_CS_COMMENT);
    if (ext != null) {
      hasExtensions=true;
      String bc=ext.hasValue() ? ext.getValue().primitiveValue() : null;
      Map<String,String> translations=ToolingExtensions.getLanguageTranslations(ext.getValue());
      if (lang == null) {
        if (bc != null)         td.addText(bc);
      }
 else       if (lang.equals("String_Node_Str")) {
        boolean sl=false;
        for (        String l : translations.keySet())         if (bc == null || !bc.equalsIgnoreCase(translations.get(l)))         sl=true;
        if (bc != null) {
          td.addText((sl ? cs.getLanguage("String_Node_Str") : "String_Node_Str") + bc);
        }
        for (        String l : translations.keySet()) {
          if (bc == null || !bc.equalsIgnoreCase(translations.get(l))) {
            if (!td.getChildNodes().isEmpty())             td.br();
            td.addText(l + "String_Node_Str" + translations.get(l));
          }
        }
      }
 else       if (lang.equals(cs.getLanguage()) || (lang.equals("String_Node_Str") && !cs.hasLanguage())) {
        if (bc != null)         td.addText(bc);
      }
 else {
        if (bc != null)         translations.put(cs.getLanguage("String_Node_Str"),bc);
        for (        String l : translations.keySet()) {
          if (l.equals(lang)) {
            td.addText(translations.get(l));
          }
        }
      }
    }
  }
  if (version) {
    td=tr.td();
    if (c.hasUserData("String_Node_Str"))     td.addText(c.getUserString("String_Node_Str"));
  }
  for (  UsedConceptMap m : maps) {
    td=tr.td();
    List<TargetElementComponentWrapper> mappings=findMappingsForCode(c.getCode(),m.getMap());
    boolean first=true;
    for (    TargetElementComponentWrapper mapping : mappings) {
      if (!first)       td.br();
      first=false;
      XhtmlNode span=td.span(null,mapping.comp.hasEquivalence() ? mapping.comp.getEquivalence().toCode() : "String_Node_Str");
      span.addText(getCharForEquivalence(mapping.comp));
      a=td.ah(prefix + m.getLink() + "String_Node_Str"+ makeAnchor(mapping.group.getTarget(),mapping.comp.getCode()));
      a.addText(mapping.comp.getCode());
      if (!Utilities.noString(mapping.comp.getComment()))       td.i().tx("String_Node_Str" + mapping.comp.getComment() + "String_Node_Str");
    }
  }
  for (  CodeType e : ToolingExtensions.getSubsumes(c)) {
    hasExtensions=true;
    tr=t.tr();
    td=tr.td();
    String s=Utilities.padLeft("String_Node_Str",'.',i * 2);
    td.addText(s);
    a=td.ah("String_Node_Str" + Utilities.nmtokenize(e.getValue()));
    a.addText(c.getCode());
  }
  for (  ConceptDefinitionComponent cc : c.getConcept()) {
    hasExtensions=addDefineRowToTable(t,cc,i + 1,hasHierarchy,hasDisplay,comment,version,deprecated,maps,system,cs,lang) || hasExtensions;
  }
  return hasExtensions;
}