Program: 23199
Project: 23199
Buggy source:
private void generateCoreElemSliced(StringBuilder b,List<ElementDefinition> elements,ElementDefinition elem,List<ElementDefinition> children,int indent,String pathName,boolean asValue,TypeRefComponent type,boolean last,boolean complex) throws Exception {
  String name=tail(elem.getPath());
  String en=asValue ? "String_Node_Str" : name;
  if (en.contains("String_Node_Str"))   en=en.replace("String_Node_Str",upFirst(type.getCode()));
  boolean unbounded=elem.hasMax() && elem.getMax().equals("String_Node_Str");
  String indentS="String_Node_Str";
  for (int i=0; i < indent; i++) {
    indentS+="String_Node_Str";
  }
  String defPage=igp.getLinkForProfile(sd,sd.getUrl());
  b.append(indentS);
  b.append("String_Node_Str" + (defPage + "String_Node_Str" + pathName+ "String_Node_Str"+ en) + "String_Node_Str"+ Utilities.escapeXml(getEnhancedDefinition(elem))+ "String_Node_Str"+ en+ "String_Node_Str");
  b.append("String_Node_Str" + describeSlicing(elem.getSlicing()) + "String_Node_Str");
  b.append("String_Node_Str");
  List<ElementDefinition> slices=getSlices(elem,children);
  int c=0;
  for (  ElementDefinition slice : slices) {
    b.append(indentS + "String_Node_Str");
    b.append("String_Node_Str" + Utilities.escapeXml(slice.getShort()) + "String_Node_Str");
    b.append("String_Node_Str");
    writeCardinality(b,slice);
    b.append("String_Node_Str");
    List<ElementDefinition> extchildren=getChildren(elements,slice);
    boolean extcomplex=isComplex(extchildren) && complex;
    if (!extcomplex) {
      b.append(indentS + "String_Node_Str");
      b.append("String_Node_Str" + prefix + "String_Node_Str");
    }
    int cc=0;
    int l=lastChild(extchildren);
    for (    ElementDefinition child : extchildren)     if (child.hasSlicing())     generateCoreElemSliced(b,elements,child,children,indent + 2,pathName + "String_Node_Str" + en,false,child.getType().get(0),++cc == l,extcomplex);
 else     if (wasSliced(child,children))     ;
 else     if (child.getType().size() == 1)     generateCoreElem(b,elements,child,indent + 2,pathName + "String_Node_Str" + en,false,child.getType().get(0),++cc == l,extcomplex);
 else {
      b.append("String_Node_Str" + Utilities.escapeXml(child.getShort()) + "String_Node_Str"+ Integer.toString(child.getType().size())+ "String_Node_Str");
      for (      TypeRefComponent t : child.getType())       generateCoreElem(b,elements,child,indent + 2,pathName + "String_Node_Str" + en,false,t,++cc == l,false);
    }
    c++;
    b.append(indentS);
    if (c == slices.size())     b.append("String_Node_Str");
 else     b.append("String_Node_Str");
  }
  b.append(indentS);
  if (last)   b.append("String_Node_Str");
 else   b.append("String_Node_Str");
}

Fixed version (ground truth):
private void generateCoreElemSliced(StringBuilder b,List<ElementDefinition> elements,ElementDefinition elem,List<ElementDefinition> children,int indent,String pathName,boolean asValue,TypeRefComponent type,boolean last,boolean complex) throws Exception {
  if (elem.getMax().equals("String_Node_Str"))   return;
  String name=tail(elem.getPath());
  String en=asValue ? "String_Node_Str" : name;
  if (en.contains("String_Node_Str"))   en=en.replace("String_Node_Str",upFirst(type.getCode()));
  boolean unbounded=elem.hasMax() && elem.getMax().equals("String_Node_Str");
  String indentS="String_Node_Str";
  for (int i=0; i < indent; i++) {
    indentS+="String_Node_Str";
  }
  String defPage=igp.getLinkForProfile(sd,sd.getUrl());
  b.append(indentS);
  b.append("String_Node_Str" + (defPage + "String_Node_Str" + pathName+ "String_Node_Str"+ en) + "String_Node_Str"+ Utilities.escapeXml(getEnhancedDefinition(elem))+ "String_Node_Str"+ en+ "String_Node_Str");
  b.append("String_Node_Str" + describeSlicing(elem.getSlicing()) + "String_Node_Str");
  b.append("String_Node_Str");
  List<ElementDefinition> slices=getSlices(elem,children);
  int c=0;
  for (  ElementDefinition slice : slices) {
    b.append(indentS + "String_Node_Str");
    b.append("String_Node_Str" + Utilities.escapeXml(slice.getShort()) + "String_Node_Str");
    b.append("String_Node_Str");
    writeCardinality(unbounded,b,slice);
    b.append("String_Node_Str");
    List<ElementDefinition> extchildren=getChildren(elements,slice);
    boolean extcomplex=isComplex(extchildren) && complex;
    if (!extcomplex && !hasExtensionChild(extchildren)) {
      b.append(indentS + "String_Node_Str");
      b.append("String_Node_Str" + prefix + "String_Node_Str");
    }
    int cc=0;
    int l=lastChild(extchildren);
    for (    ElementDefinition child : extchildren)     if (child.hasSlicing())     generateCoreElemSliced(b,elements,child,children,indent + 2,pathName + "String_Node_Str" + en,false,child.getType().get(0),++cc == l,extcomplex);
 else     if (wasSliced(child,children))     ;
 else     if (child.getType().size() == 1)     generateCoreElem(b,elements,child,indent + 2,pathName + "String_Node_Str" + en,false,child.getType().get(0),++cc == l,extcomplex);
 else {
      b.append("String_Node_Str" + Utilities.escapeXml(child.getShort()) + "String_Node_Str"+ Integer.toString(child.getType().size())+ "String_Node_Str");
      for (      TypeRefComponent t : child.getType())       generateCoreElem(b,elements,child,indent + 2,pathName + "String_Node_Str" + en,false,t,++cc == l,false);
    }
    c++;
    b.append(indentS);
    if (c == slices.size())     b.append("String_Node_Str");
 else     b.append("String_Node_Str");
  }
  b.append(indentS);
  if (last)   b.append("String_Node_Str");
 else   b.append("String_Node_Str");
}