Program: 23116
Project: 23116
Buggy source:
private Cell generateDescription(HierarchicalTableGenerator gen,Row row,ElementDefinition definition,ElementDefinition fallback,boolean used,String baseURL,String url,StructureDefinition profile,String corePath,String imagePath,boolean root,boolean logicalModel,boolean allInvariants,ElementDefinition valueDefn) throws IOException {
  Cell c=gen.new Cell();
  row.getCells().add(c);
  if (used) {
    if (logicalModel && ToolingExtensions.hasExtension(profile,"String_Node_Str")) {
      if (root) {
        c.getPieces().add(gen.new Piece(null,translate("String_Node_Str","String_Node_Str") + "String_Node_Str",null).addStyle("String_Node_Str"));
        c.getPieces().add(gen.new Piece(null,ToolingExtensions.readStringExtension(profile,"String_Node_Str"),null));
      }
 else       if (!root && ToolingExtensions.hasExtension(definition,"String_Node_Str") && !ToolingExtensions.readStringExtension(definition,"String_Node_Str").equals(ToolingExtensions.readStringExtension(profile,"String_Node_Str"))) {
        c.getPieces().add(gen.new Piece(null,translate("String_Node_Str","String_Node_Str") + "String_Node_Str",null).addStyle("String_Node_Str"));
        c.getPieces().add(gen.new Piece(null,ToolingExtensions.readStringExtension(definition,"String_Node_Str"),null));
      }
    }
    if (definition.hasContentReference()) {
      ElementDefinition ed=getElementByName(profile.getSnapshot().getElement(),definition.getContentReference());
      if (ed == null)       c.getPieces().add(gen.new Piece(null,translate("String_Node_Str","String_Node_Str",definition.getContentReference()),null));
 else       c.getPieces().add(gen.new Piece("String_Node_Str" + ed.getPath(),translate("String_Node_Str","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 (definition != null && definition.hasShort()) {
        if (!c.getPieces().isEmpty())         c.addPiece(gen.new Piece("String_Node_Str"));
        c.addPiece(checkForNoChange(definition.getShortElement(),gen.new Piece(null,gt(definition.getShortElement()),null)));
      }
 else       if (fallback != null && fallback != null && fallback.hasShort()) {
        if (!c.getPieces().isEmpty())         c.addPiece(gen.new Piece("String_Node_Str"));
        c.addPiece(checkForNoChange(fallback.getShortElement(),gen.new Piece(null,gt(fallback.getShortElement()),null)));
      }
      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.pathURL(corePath,p);
          }
        }
        c.getPieces().add(gen.new Piece(null,translate("String_Node_Str","String_Node_Str") + "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,translate("String_Node_Str","String_Node_Str") + "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,translate("String_Node_Str","String_Node_Str") + "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(),egt(binding.getStrengthElement()),binding.getStrength().getDefinition())));
            c.getPieces().add(gen.new Piece(null,"String_Node_Str",null));
          }
        }
        for (        ElementDefinitionConstraintComponent inv : definition.getConstraint()) {
          if (!inv.hasSource() || allInvariants) {
            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,gt(inv.getHumanElement()),null)));
          }
        }
        if ((definition.hasBase() && definition.getBase().getMax().equals("String_Node_Str")) || (definition.hasMax() && definition.getMax().equals("String_Node_Str"))) {
          if (c.getPieces().size() > 0)           c.addPiece(gen.new Piece("String_Node_Str"));
          if (definition.hasOrderMeaning()) {
            c.getPieces().add(gen.new Piece(null,"String_Node_Str" + definition.getOrderMeaning(),null));
          }
 else {
          }
        }
        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,translate("String_Node_Str","String_Node_Str") + "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")));
          if (isCoded(definition.getFixed()) && !hasDescription(definition.getFixed())) {
            Piece p=describeCoded(gen,definition.getFixed());
            if (p != null)             c.getPieces().add(p);
          }
        }
 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,translate("String_Node_Str","String_Node_Str") + "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,translate("String_Node_Str","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));
                }
              }
            }
          }
        }
      }
    }
  }
  return c;
}

Fixed version (ground truth):
private Cell generateDescription(HierarchicalTableGenerator gen,Row row,ElementDefinition definition,ElementDefinition fallback,boolean used,String baseURL,String url,StructureDefinition profile,String corePath,String imagePath,boolean root,boolean logicalModel,boolean allInvariants,ElementDefinition valueDefn) throws IOException {
  Cell c=gen.new Cell();
  row.getCells().add(c);
  if (used) {
    if (logicalModel && ToolingExtensions.hasExtension(profile,"String_Node_Str")) {
      if (root) {
        c.getPieces().add(gen.new Piece(null,translate("String_Node_Str","String_Node_Str") + "String_Node_Str",null).addStyle("String_Node_Str"));
        c.getPieces().add(gen.new Piece(null,ToolingExtensions.readStringExtension(profile,"String_Node_Str"),null));
      }
 else       if (!root && ToolingExtensions.hasExtension(definition,"String_Node_Str") && !ToolingExtensions.readStringExtension(definition,"String_Node_Str").equals(ToolingExtensions.readStringExtension(profile,"String_Node_Str"))) {
        c.getPieces().add(gen.new Piece(null,translate("String_Node_Str","String_Node_Str") + "String_Node_Str",null).addStyle("String_Node_Str"));
        c.getPieces().add(gen.new Piece(null,ToolingExtensions.readStringExtension(definition,"String_Node_Str"),null));
      }
    }
    if (definition.hasContentReference()) {
      ElementDefinition ed=getElementByName(profile.getSnapshot().getElement(),definition.getContentReference());
      if (ed == null)       c.getPieces().add(gen.new Piece(null,translate("String_Node_Str","String_Node_Str",definition.getContentReference()),null));
 else       c.getPieces().add(gen.new Piece("String_Node_Str" + ed.getPath(),translate("String_Node_Str","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 (definition != null && definition.hasShort()) {
        if (!c.getPieces().isEmpty())         c.addPiece(gen.new Piece("String_Node_Str"));
        c.addPiece(checkForNoChange(definition.getShortElement(),gen.new Piece(null,gt(definition.getShortElement()),null)));
      }
 else       if (fallback != null && fallback.hasShort()) {
        if (!c.getPieces().isEmpty())         c.addPiece(gen.new Piece("String_Node_Str"));
        c.addPiece(checkForNoChange(fallback.getShortElement(),gen.new Piece(null,gt(fallback.getShortElement()),null)));
      }
      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.pathURL(corePath,p);
          }
        }
        c.getPieces().add(gen.new Piece(null,translate("String_Node_Str","String_Node_Str") + "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,translate("String_Node_Str","String_Node_Str") + "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,translate("String_Node_Str","String_Node_Str") + "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(),egt(binding.getStrengthElement()),binding.getStrength().getDefinition())));
            c.getPieces().add(gen.new Piece(null,"String_Node_Str",null));
          }
        }
        for (        ElementDefinitionConstraintComponent inv : definition.getConstraint()) {
          if (!inv.hasSource() || allInvariants) {
            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,gt(inv.getHumanElement()),null)));
          }
        }
        if ((definition.hasBase() && definition.getBase().getMax().equals("String_Node_Str")) || (definition.hasMax() && definition.getMax().equals("String_Node_Str"))) {
          if (c.getPieces().size() > 0)           c.addPiece(gen.new Piece("String_Node_Str"));
          if (definition.hasOrderMeaning()) {
            c.getPieces().add(gen.new Piece(null,"String_Node_Str" + definition.getOrderMeaning(),null));
          }
 else {
          }
        }
        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,translate("String_Node_Str","String_Node_Str") + "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")));
          if (isCoded(definition.getFixed()) && !hasDescription(definition.getFixed())) {
            Piece p=describeCoded(gen,definition.getFixed());
            if (p != null)             c.getPieces().add(p);
          }
        }
 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,translate("String_Node_Str","String_Node_Str") + "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,translate("String_Node_Str","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));
                }
              }
            }
          }
        }
      }
    }
  }
  return c;
}