Program: 23047
Project: 23047
Buggy source:
private void generateDefinitions(FhirFormat fmt,String specFile) throws Exception {
  Set<FetchedResource> files=new HashSet<FetchedResource>();
  for (  FetchedFile f : fileList) {
    for (    FetchedResource r : f.getResources()) {
      if (r.getResource() != null && r.getResource() instanceof MetadataResource) {
        files.add(r);
      }
    }
  }
  if (!files.isEmpty()) {
    ZipGenerator zip=new ZipGenerator(Utilities.path(outputDir,"String_Node_Str" + fmt.getExtension() + "String_Node_Str"));
    for (    FetchedResource r : files) {
      ByteArrayOutputStream bs=new ByteArrayOutputStream();
      if (fmt.equals(FhirFormat.JSON))       new JsonParser().compose(bs,r.getResource());
 else       if (fmt.equals(FhirFormat.XML))       new XmlParser().compose(bs,r.getResource());
 else       if (fmt.equals(FhirFormat.TURTLE))       new TurtleParser(context).compose(r.getElement(),bs,OutputStyle.PRETTY,igpkp.getCanonical());
      zip.addBytes(r.getElement().fhirType() + "String_Node_Str" + r.getId()+ "String_Node_Str"+ fmt.getExtension(),bs.toByteArray(),false);
    }
    zip.addFileName("String_Node_Str",specFile,false);
    zip.close();
  }
}

Fixed version (ground truth):
private void generateDefinitions(FhirFormat fmt,String specFile) throws Exception {
  Set<FetchedResource> files=new HashSet<FetchedResource>();
  for (  FetchedFile f : fileList) {
    for (    FetchedResource r : f.getResources()) {
      if (r.getResource() != null && r.getResource() instanceof MetadataResource) {
        files.add(r);
      }
    }
  }
  if (!files.isEmpty()) {
    ZipGenerator zip=new ZipGenerator(Utilities.path(outputDir,"String_Node_Str" + fmt.getExtension() + "String_Node_Str"));
    for (    FetchedResource r : files) {
      ByteArrayOutputStream bs=new ByteArrayOutputStream();
      if (version.equals("String_Node_Str")) {
        org.hl7.fhir.dstu3.model.Resource r3=VersionConvertor_30_40.convertResource(r.getResource());
        if (fmt.equals(FhirFormat.JSON))         new org.hl7.fhir.dstu3.formats.JsonParser().compose(bs,r3);
 else         if (fmt.equals(FhirFormat.XML))         new org.hl7.fhir.dstu3.formats.XmlParser().compose(bs,r3);
 else         if (fmt.equals(FhirFormat.TURTLE))         new org.hl7.fhir.dstu3.formats.RdfParser().compose(bs,r3);
      }
 else       if (version.equals("String_Node_Str")) {
        org.hl7.fhir.dstu2016may.model.Resource r14=VersionConvertor_14_40.convertResource(r.getResource());
        if (fmt.equals(FhirFormat.JSON))         new org.hl7.fhir.dstu2016may.formats.JsonParser().compose(bs,r14);
 else         if (fmt.equals(FhirFormat.XML))         new org.hl7.fhir.dstu2016may.formats.XmlParser().compose(bs,r14);
 else         if (fmt.equals(FhirFormat.TURTLE))         new org.hl7.fhir.dstu2016may.formats.RdfParser().compose(bs,r14);
      }
 else       if (version.equals("String_Node_Str")) {
        VersionConvertorAdvisor40 advisor=new IGR2ConvertorAdvisor();
        org.hl7.fhir.dstu2.model.Resource r14=new VersionConvertor_10_40(advisor).convertResource(r.getResource());
        if (fmt.equals(FhirFormat.JSON))         new org.hl7.fhir.dstu2.formats.JsonParser().compose(bs,r14);
 else         if (fmt.equals(FhirFormat.XML))         new org.hl7.fhir.dstu2.formats.XmlParser().compose(bs,r14);
 else         if (fmt.equals(FhirFormat.TURTLE))         throw new Exception("String_Node_Str");
      }
 else {
        if (fmt.equals(FhirFormat.JSON))         new JsonParser().compose(bs,r.getResource());
 else         if (fmt.equals(FhirFormat.XML))         new XmlParser().compose(bs,r.getResource());
 else         if (fmt.equals(FhirFormat.TURTLE))         new TurtleParser(context).compose(r.getElement(),bs,OutputStyle.PRETTY,igpkp.getCanonical());
      }
      zip.addBytes(r.getElement().fhirType() + "String_Node_Str" + r.getId()+ "String_Node_Str"+ fmt.getExtension(),bs.toByteArray(),false);
    }
    zip.addFileName("String_Node_Str",specFile,false);
    zip.close();
  }
}