Program: 23311
Project: 23311
Buggy source:
private Cell generateGridDescription(HierarchicalTableGenerator gen,Row row,ElementDefinition definition,ElementDefinition fallback,boolean used,String baseURL,String url,StructureDefinition profile,String corePath,String imagePath,boolean root,ElementDefinition valueDefn) throws IOException {
  Cell c=gen.new Cell();
  row.getCells().add(c);
  if (used) {
    if (definition.hasContentReference()) {
      ElementDefinition ed=getElementByName(profile.getSnapshot().getElement(),definition.getContentReference());
      if (ed == null)       c.getPieces().add(gen.new Piece(null,"String_Node_Str" + definition.getContentReference(),null));
 else       c.getPieces().add(gen.new Piece("String_Node_Str" + ed.getPath(),"String_Node_Str" + ed.getPath(),null));
    }
    if (definition.getPath().endsWith("String_Node_Str") && definition.hasFixed()) {
      c.getPieces().add(checkForNoChange(definition.getFixed(),gen.new Piece(null,"String_Node_Str" + buildJson(definition.getFixed()) + "String_Node_Str",null).addStyle("String_Node_Str")));
    }
 else {
      if (url != null) {
        if (!c.getPieces().isEmpty())         c.addPiece(gen.new Piece("String_Node_Str"));
        String fullUrl=url.startsWith("String_Node_Str") ? baseURL + url : url;
        StructureDefinition ed=context.fetchResource(StructureDefinition.class,url);
        String ref=null;
        if (ed != null) {
          String p=ed.getUserString("String_Node_Str");
          if (p != null) {
            ref=p.startsWith("String_Node_Str") || igmode ? p : Utilities.pathReverse(corePath,p);
          }
        }
        c.getPieces().add(gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str"));
        c.getPieces().add(gen.new Piece(ref,fullUrl,null));
      }
      if (definition.hasSlicing()) {
        if (!c.getPieces().isEmpty())         c.addPiece(gen.new Piece("String_Node_Str"));
        c.getPieces().add(gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str"));
        c.getPieces().add(gen.new Piece(null,describeSlice(definition.getSlicing()),null));
      }
      if (definition != null) {
        ElementDefinitionBindingComponent binding=null;
        if (valueDefn != null && valueDefn.hasBinding() && !valueDefn.getBinding().isEmpty())         binding=valueDefn.getBinding();
 else         if (definition.hasBinding())         binding=definition.getBinding();
        if (binding != null && !binding.isEmpty()) {
          if (!c.getPieces().isEmpty())           c.addPiece(gen.new Piece("String_Node_Str"));
          BindingResolution br=pkp.resolveBinding(profile,binding,definition.getPath());
          c.getPieces().add(checkForNoChange(binding,gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str")));
          c.getPieces().add(checkForNoChange(binding,gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !pkp.prependLinks() ? br.url : corePath + br.url,br.display,null)));
          if (binding.hasStrength()) {
            c.getPieces().add(checkForNoChange(binding,gen.new Piece(null,"String_Node_Str",null)));
            c.getPieces().add(checkForNoChange(binding,gen.new Piece(corePath + "String_Node_Str" + binding.getStrength().toCode(),binding.getStrength().toCode(),binding.getStrength().getDefinition())));
            c.getPieces().add(gen.new Piece(null,"String_Node_Str",null));
          }
        }
        for (        ElementDefinitionConstraintComponent inv : definition.getConstraint()) {
          if (!c.getPieces().isEmpty())           c.addPiece(gen.new Piece("String_Node_Str"));
          c.getPieces().add(checkForNoChange(inv,gen.new Piece(null,inv.getKey() + "String_Node_Str",null).addStyle("String_Node_Str")));
          c.getPieces().add(checkForNoChange(inv,gen.new Piece(null,inv.getHuman(),null)));
        }
        if (definition.hasFixed()) {
          if (!c.getPieces().isEmpty())           c.addPiece(gen.new Piece("String_Node_Str"));
          c.getPieces().add(checkForNoChange(definition.getFixed(),gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str")));
          c.getPieces().add(checkForNoChange(definition.getFixed(),gen.new Piece(null,buildJson(definition.getFixed()),null).addStyle("String_Node_Str")));
        }
 else         if (definition.hasPattern()) {
          if (!c.getPieces().isEmpty())           c.addPiece(gen.new Piece("String_Node_Str"));
          c.getPieces().add(checkForNoChange(definition.getPattern(),gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str")));
          c.getPieces().add(checkForNoChange(definition.getPattern(),gen.new Piece(null,buildJson(definition.getPattern()),null).addStyle("String_Node_Str")));
        }
 else         if (definition.hasExample()) {
          for (          ElementDefinitionExampleComponent ex : definition.getExample()) {
            if (!c.getPieces().isEmpty())             c.addPiece(gen.new Piece("String_Node_Str"));
            c.getPieces().add(checkForNoChange(ex,gen.new Piece(null,"String_Node_Str" + ("String_Node_Str".equals("String_Node_Str") ? "String_Node_Str" : "String_Node_Str" + ex.getLabel() + "String_Node_Str") + "String_Node_Str",null).addStyle("String_Node_Str")));
            c.getPieces().add(checkForNoChange(ex,gen.new Piece(null,buildJson(ex.getValue()),null).addStyle("String_Node_Str")));
          }
        }
        if (profile != null) {
          for (          StructureDefinitionMappingComponent md : profile.getMapping()) {
            if (md.hasExtension(ToolingExtensions.EXT_TABLE_NAME)) {
              ElementDefinitionMappingComponent map=null;
              for (              ElementDefinitionMappingComponent m : definition.getMapping())               if (m.getIdentity().equals(md.getIdentity()))               map=m;
              if (map != null) {
                for (int i=0; i < definition.getMapping().size(); i++) {
                  c.addPiece(gen.new Piece("String_Node_Str"));
                  c.getPieces().add(gen.new Piece(null,ToolingExtensions.readStringExtension(md,ToolingExtensions.EXT_TABLE_NAME) + "String_Node_Str" + map.getMap(),null));
                }
              }
            }
          }
        }
        if (definition.getComments() != null) {
          if (!c.getPieces().isEmpty())           c.addPiece(gen.new Piece("String_Node_Str"));
          c.getPieces().add(gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str"));
          c.addPiece(gen.new Piece("String_Node_Str"));
          c.addMarkdown(definition.getComments());
        }
      }
    }
  }
  return c;
}

Fixed version (ground truth):
private Cell generateGridDescription(HierarchicalTableGenerator gen,Row row,ElementDefinition definition,ElementDefinition fallback,boolean used,String baseURL,String url,StructureDefinition profile,String corePath,String imagePath,boolean root,ElementDefinition valueDefn) throws IOException {
  Cell c=gen.new Cell();
  row.getCells().add(c);
  if (used) {
    if (definition.hasContentReference()) {
      ElementDefinition ed=getElementByName(profile.getSnapshot().getElement(),definition.getContentReference());
      if (ed == null)       c.getPieces().add(gen.new Piece(null,"String_Node_Str" + definition.getContentReference(),null));
 else       c.getPieces().add(gen.new Piece("String_Node_Str" + ed.getPath(),"String_Node_Str" + ed.getPath(),null));
    }
    if (definition.getPath().endsWith("String_Node_Str") && definition.hasFixed()) {
      c.getPieces().add(checkForNoChange(definition.getFixed(),gen.new Piece(null,"String_Node_Str" + buildJson(definition.getFixed()) + "String_Node_Str",null).addStyle("String_Node_Str")));
    }
 else {
      if (url != null) {
        if (!c.getPieces().isEmpty())         c.addPiece(gen.new Piece("String_Node_Str"));
        String fullUrl=url.startsWith("String_Node_Str") ? baseURL + url : url;
        StructureDefinition ed=context.fetchResource(StructureDefinition.class,url);
        String ref=null;
        if (ed != null) {
          String p=ed.getUserString("String_Node_Str");
          if (p != null) {
            ref=p.startsWith("String_Node_Str") || igmode ? p : Utilities.pathReverse(corePath,p);
          }
        }
        c.getPieces().add(gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str"));
        c.getPieces().add(gen.new Piece(ref,fullUrl,null));
      }
      if (definition.hasSlicing()) {
        if (!c.getPieces().isEmpty())         c.addPiece(gen.new Piece("String_Node_Str"));
        c.getPieces().add(gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str"));
        c.getPieces().add(gen.new Piece(null,describeSlice(definition.getSlicing()),null));
      }
      if (definition != null) {
        ElementDefinitionBindingComponent binding=null;
        if (valueDefn != null && valueDefn.hasBinding() && !valueDefn.getBinding().isEmpty())         binding=valueDefn.getBinding();
 else         if (definition.hasBinding())         binding=definition.getBinding();
        if (binding != null && !binding.isEmpty()) {
          if (!c.getPieces().isEmpty())           c.addPiece(gen.new Piece("String_Node_Str"));
          BindingResolution br=pkp.resolveBinding(profile,binding,definition.getPath());
          c.getPieces().add(checkForNoChange(binding,gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str")));
          c.getPieces().add(checkForNoChange(binding,gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !pkp.prependLinks() ? br.url : corePath + br.url,br.display,null)));
          if (binding.hasStrength()) {
            c.getPieces().add(checkForNoChange(binding,gen.new Piece(null,"String_Node_Str",null)));
            c.getPieces().add(checkForNoChange(binding,gen.new Piece(corePath + "String_Node_Str" + binding.getStrength().toCode(),binding.getStrength().toCode(),binding.getStrength().getDefinition())));
            c.getPieces().add(gen.new Piece(null,"String_Node_Str",null));
          }
        }
        for (        ElementDefinitionConstraintComponent inv : definition.getConstraint()) {
          if (!c.getPieces().isEmpty())           c.addPiece(gen.new Piece("String_Node_Str"));
          c.getPieces().add(checkForNoChange(inv,gen.new Piece(null,inv.getKey() + "String_Node_Str",null).addStyle("String_Node_Str")));
          c.getPieces().add(checkForNoChange(inv,gen.new Piece(null,inv.getHuman(),null)));
        }
        if (definition.hasFixed()) {
          if (!c.getPieces().isEmpty())           c.addPiece(gen.new Piece("String_Node_Str"));
          c.getPieces().add(checkForNoChange(definition.getFixed(),gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str")));
          c.getPieces().add(checkForNoChange(definition.getFixed(),gen.new Piece(null,buildJson(definition.getFixed()),null).addStyle("String_Node_Str")));
        }
 else         if (definition.hasPattern()) {
          if (!c.getPieces().isEmpty())           c.addPiece(gen.new Piece("String_Node_Str"));
          c.getPieces().add(checkForNoChange(definition.getPattern(),gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str")));
          c.getPieces().add(checkForNoChange(definition.getPattern(),gen.new Piece(null,buildJson(definition.getPattern()),null).addStyle("String_Node_Str")));
        }
 else         if (definition.hasExample()) {
          for (          ElementDefinitionExampleComponent ex : definition.getExample()) {
            if (!c.getPieces().isEmpty())             c.addPiece(gen.new Piece("String_Node_Str"));
            c.getPieces().add(checkForNoChange(ex,gen.new Piece(null,"String_Node_Str" + ("String_Node_Str".equals("String_Node_Str") ? "String_Node_Str" : "String_Node_Str" + ex.getLabel() + "String_Node_Str") + "String_Node_Str",null).addStyle("String_Node_Str")));
            c.getPieces().add(checkForNoChange(ex,gen.new Piece(null,buildJson(ex.getValue()),null).addStyle("String_Node_Str")));
          }
        }
        if (definition.hasMaxLength() && definition.getMaxLength() != 0) {
          if (!c.getPieces().isEmpty())           c.addPiece(gen.new Piece("String_Node_Str"));
          c.getPieces().add(checkForNoChange(definition.getMaxLengthElement(),gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str")));
          c.getPieces().add(checkForNoChange(definition.getMaxLengthElement(),gen.new Piece(null,Integer.toString(definition.getMaxLength()),null).addStyle("String_Node_Str")));
        }
        if (profile != null) {
          for (          StructureDefinitionMappingComponent md : profile.getMapping()) {
            if (md.hasExtension(ToolingExtensions.EXT_TABLE_NAME)) {
              ElementDefinitionMappingComponent map=null;
              for (              ElementDefinitionMappingComponent m : definition.getMapping())               if (m.getIdentity().equals(md.getIdentity()))               map=m;
              if (map != null) {
                for (int i=0; i < definition.getMapping().size(); i++) {
                  c.addPiece(gen.new Piece("String_Node_Str"));
                  c.getPieces().add(gen.new Piece(null,ToolingExtensions.readStringExtension(md,ToolingExtensions.EXT_TABLE_NAME) + "String_Node_Str" + map.getMap(),null));
                }
              }
            }
          }
        }
        if (definition.getComments() != null) {
          if (!c.getPieces().isEmpty())           c.addPiece(gen.new Piece("String_Node_Str"));
          c.getPieces().add(gen.new Piece(null,"String_Node_Str",null).addStyle("String_Node_Str"));
          c.addPiece(gen.new Piece("String_Node_Str"));
          c.addMarkdown(definition.getComments());
        }
      }
    }
  }
  return c;
}