Program: 24150
Project: 24150
Buggy source:
private void genElement(String defPath,HeirarchicalTableGenerator gen,List<Row> rows,ElementComponent element,List<ElementComponent> all,Profile profile,ProfileKnowledgeProvider pkp,boolean showMissing,String profileBaseFileName) throws Exception {
  if (!onlyInformationIsMapping(all,element)) {
    Row row=gen.new Row();
    row.setAnchor(element.getPathSimple());
    String s=tail(element.getPathSimple());
    boolean hasDef=element.getDefinition() != null;
    boolean ext=false;
    if (s.equals("String_Node_Str") || s.equals("String_Node_Str")) {
      row.setIcon("String_Node_Str");
      ext=true;
    }
 else     if (!hasDef || element.getDefinition().getType().size() == 0)     row.setIcon("String_Node_Str");
 else     if (hasDef && element.getDefinition().getType().size() > 1) {
      if (allTypesAre(element.getDefinition().getType(),"String_Node_Str"))       row.setIcon("String_Node_Str");
 else       row.setIcon("String_Node_Str");
    }
 else     if (hasDef && element.getDefinition().getType().get(0).getCode().getValue().startsWith("String_Node_Str"))     row.setIcon("String_Node_Str");
 else     if (hasDef && isPrimitive(element.getDefinition().getType().get(0).getCode().getValue()))     row.setIcon("String_Node_Str");
 else     if (hasDef && isReference(element.getDefinition().getType().get(0).getCode().getValue()))     row.setIcon("String_Node_Str");
 else     if (hasDef && isDataType(element.getDefinition().getType().get(0).getCode().getValue()))     row.setIcon("String_Node_Str");
 else     row.setIcon("String_Node_Str");
    String ref=defPath == null ? null : defPath + makePathLink(element);
    UnusedTracker used=new UnusedTracker();
    used.used=true;
    Cell left=gen.new Cell(null,ref,s,!hasDef ? null : element.getDefinition().getFormalSimple(),null);
    row.getCells().add(left);
    if (ext) {
      if (element.getDefinition() != null && element.getDefinition().getType().size() == 1 && element.getDefinition().getType().get(0).getProfile() != null) {
        ExtensionDefinition extDefn=pkp.getExtensionDefinition(profile,element.getDefinition().getType().get(0).getProfileSimple());
        if (extDefn == null) {
          row.getCells().add(gen.new Cell(null,null,!hasDef ? null : describeCardinality(element.getDefinition(),null,used),null,null));
          row.getCells().add(gen.new Cell(null,null,"String_Node_Str" + element.getDefinition().getType().get(0).getProfileSimple(),null,null));
          generateDescription(gen,row,element,null,used.used,profile.getUrlSimple(),element.getDefinition().getType().get(0).getProfileSimple(),pkp,profile);
        }
 else {
          row.getCells().add(gen.new Cell(null,null,!hasDef ? null : describeCardinality(element.getDefinition(),extDefn.getDefn().getElement().get(0).getDefinition(),used),null,null));
          genTypes(gen,pkp,row,extDefn.getDefn().getElement().get(0),profileBaseFileName);
          generateDescription(gen,row,element,extDefn.getDefn().getElement().get(0),used.used,profile.getUrlSimple(),element.getDefinition().getType().get(0).getProfileSimple(),pkp,profile);
        }
      }
 else       if (element.getDefinition() != null) {
        row.getCells().add(gen.new Cell(null,null,!hasDef ? null : describeCardinality(element.getDefinition(),null,used),null,null));
        genTypes(gen,pkp,row,element,profileBaseFileName);
        generateDescription(gen,row,element,null,used.used,null,null,pkp,profile);
      }
 else {
        row.getCells().add(gen.new Cell(null,null,!hasDef ? null : describeCardinality(element.getDefinition(),null,used),null,null));
        row.getCells().add(gen.new Cell());
        generateDescription(gen,row,element,null,used.used,null,null,pkp,profile);
      }
    }
 else {
      row.getCells().add(gen.new Cell(null,null,!hasDef ? null : describeCardinality(element.getDefinition(),null,used),null,null));
      if (hasDef)       genTypes(gen,pkp,row,element,profileBaseFileName);
 else       row.getCells().add(gen.new Cell());
      generateDescription(gen,row,element,null,used.used,null,null,pkp,profile);
    }
    if (element.getSlicing() != null) {
      row.setIcon("String_Node_Str");
      row.getCells().get(2).getPieces().clear();
      for (      Cell cell : row.getCells())       for (      Piece p : cell.getPieces()) {
        p.addStyle("String_Node_Str");
      }
    }
    if (used.used || showMissing)     rows.add(row);
    if (!used.used) {
      for (      Cell cell : row.getCells())       for (      Piece p : cell.getPieces()) {
        p.setStyle("String_Node_Str");
        p.setReference(null);
      }
    }
 else {
      List<ElementComponent> children=getChildren(all,element);
      for (      ElementComponent child : children)       genElement(defPath,gen,row.getSubRows(),child,all,profile,pkp,showMissing,profileBaseFileName);
    }
  }
}

Fixed version (ground truth):
private void genElement(String defPath,HeirarchicalTableGenerator gen,List<Row> rows,ElementComponent element,List<ElementComponent> all,Profile profile,ProfileKnowledgeProvider pkp,boolean showMissing,String profileBaseFileName) throws Exception {
  if (!onlyInformationIsMapping(all,element)) {
    Row row=gen.new Row();
    row.setAnchor(element.getPathSimple());
    String s=tail(element.getPathSimple());
    boolean hasDef=element.getDefinition() != null;
    boolean ext=false;
    if (s.equals("String_Node_Str") || s.equals("String_Node_Str")) {
      row.setIcon("String_Node_Str");
      ext=true;
    }
 else     if (!hasDef || element.getDefinition().getType().size() == 0)     row.setIcon("String_Node_Str");
 else     if (hasDef && element.getDefinition().getType().size() > 1) {
      if (allTypesAre(element.getDefinition().getType(),"String_Node_Str"))       row.setIcon("String_Node_Str");
 else       row.setIcon("String_Node_Str");
    }
 else     if (hasDef && element.getDefinition().getType().get(0).getCode().getValue().startsWith("String_Node_Str"))     row.setIcon("String_Node_Str");
 else     if (hasDef && isPrimitive(element.getDefinition().getType().get(0).getCode().getValue()))     row.setIcon("String_Node_Str");
 else     if (hasDef && isReference(element.getDefinition().getType().get(0).getCode().getValue()))     row.setIcon("String_Node_Str");
 else     if (hasDef && isDataType(element.getDefinition().getType().get(0).getCode().getValue()))     row.setIcon("String_Node_Str");
 else     row.setIcon("String_Node_Str");
    String ref=defPath == null ? null : defPath + makePathLink(element);
    UnusedTracker used=new UnusedTracker();
    used.used=true;
    Cell left=gen.new Cell(null,ref,s,!hasDef ? null : element.getDefinition().getFormalSimple(),null);
    row.getCells().add(left);
    if (ext) {
      if (element.getDefinition() != null && element.getDefinition().getType().size() == 1 && element.getDefinition().getType().get(0).getProfile() != null) {
        ExtensionDefinition extDefn=pkp.getExtensionDefinition(profile,element.getDefinition().getType().get(0).getProfileSimple());
        if (extDefn == null) {
          row.getCells().add(gen.new Cell(null,null,!hasDef ? null : describeCardinality(element.getDefinition(),null,used),null,null));
          row.getCells().add(gen.new Cell(null,null,"String_Node_Str" + element.getDefinition().getType().get(0).getProfileSimple(),null,null));
          generateDescription(gen,row,element,null,used.used,profile.getUrlSimple(),element.getDefinition().getType().get(0).getProfileSimple(),pkp,profile);
        }
 else {
          row.getCells().add(gen.new Cell(null,null,!hasDef ? null : describeCardinality(element.getDefinition(),extDefn.getDefn().getElement().get(0).getDefinition(),used),null,null));
          genTypes(gen,pkp,row,extDefn.getDefn().getElement().get(0),profileBaseFileName,profile);
          generateDescription(gen,row,element,extDefn.getDefn().getElement().get(0),used.used,profile.getUrlSimple(),element.getDefinition().getType().get(0).getProfileSimple(),pkp,profile);
        }
      }
 else       if (element.getDefinition() != null) {
        row.getCells().add(gen.new Cell(null,null,!hasDef ? null : describeCardinality(element.getDefinition(),null,used),null,null));
        genTypes(gen,pkp,row,element,profileBaseFileName,profile);
        generateDescription(gen,row,element,null,used.used,null,null,pkp,profile);
      }
 else {
        row.getCells().add(gen.new Cell(null,null,!hasDef ? null : describeCardinality(element.getDefinition(),null,used),null,null));
        row.getCells().add(gen.new Cell());
        generateDescription(gen,row,element,null,used.used,null,null,pkp,profile);
      }
    }
 else {
      row.getCells().add(gen.new Cell(null,null,!hasDef ? null : describeCardinality(element.getDefinition(),null,used),null,null));
      if (hasDef)       genTypes(gen,pkp,row,element,profileBaseFileName,profile);
 else       row.getCells().add(gen.new Cell());
      generateDescription(gen,row,element,null,used.used,null,null,pkp,profile);
    }
    if (element.getSlicing() != null) {
      row.setIcon("String_Node_Str");
      row.getCells().get(2).getPieces().clear();
      for (      Cell cell : row.getCells())       for (      Piece p : cell.getPieces()) {
        p.addStyle("String_Node_Str");
      }
    }
    if (used.used || showMissing)     rows.add(row);
    if (!used.used) {
      for (      Cell cell : row.getCells())       for (      Piece p : cell.getPieces()) {
        p.setStyle("String_Node_Str");
        p.setReference(null);
      }
    }
 else {
      List<ElementComponent> children=getChildren(all,element);
      for (      ElementComponent child : children)       genElement(defPath,gen,row.getSubRows(),child,all,profile,pkp,showMissing,profileBaseFileName);
    }
  }
}