nus-yam/ex-repair huggingface dataset:
Program: 23962
Project: 23962
Buggy source:
private boolean loadPages(FetchedFile dir) throws Exception {
  boolean changed=false;
  if (!altMap.containsKey("String_Node_Str" + dir.getPath())) {
    changed=true;
    altMap.put("String_Node_Str" + dir.getPath(),dir);
    dir.setNoProcess(true);
    changeList.add(dir);
  }
  for (  String link : dir.getFiles()) {
    FetchedFile f=fetcher.fetch(link);
    if (f.isFolder())     changed=loadPages(f) || changed;
 else     changed=loadPage(f) || changed;
  }
  return changed;
}

Fixed version (ground truth):
private boolean loadPages(FetchedFile dir) throws Exception {
  boolean changed=false;
  if (!altMap.containsKey("String_Node_Str" + dir.getPath())) {
    changed=true;
    altMap.put("String_Node_Str" + dir.getPath(),dir);
    dir.setProcessMode(FetchedFile.PROCESS_NONE);
    changeList.add(dir);
  }
  for (  String link : dir.getFiles()) {
    FetchedFile f=fetcher.fetch(link);
    if (f.isFolder())     changed=loadPages(f) || changed;
 else     changed=loadPage(f) || changed;
  }
  return changed;
}
Program: 23964
Project: 23964
Buggy source:
@Override protected void listChildren(List<org.hl7.fhir.dstu3.model.Property> result){
}

Fixed version (ground truth):
@Override protected void listChildren(List<org.hl7.fhir.dstu3.model.Property> childProps){
  for (  Element c : children) {
    childProps.add(new org.hl7.fhir.dstu3.model.Property(c.getName(),c.fhirType(),c.getProperty().getDefinition().getDefinition(),c.getProperty().getDefinition().getMin(),maxToInt(c.getProperty().getDefinition().getMax()),c));
  }
}
Program: 23965
Project: 23965
Buggy source:
@Override protected void listChildren(List<org.hl7.fhir.dstu3.model.Property> result){
}

Fixed version (ground truth):
@Override protected void listChildren(List<org.hl7.fhir.dstu3.model.Property> childProps){
  for (  Element c : children) {
    childProps.add(new org.hl7.fhir.dstu3.model.Property(c.getName(),c.fhirType(),c.getProperty().getDefinition().getDefinition(),c.getProperty().getDefinition().getMin(),maxToInt(c.getProperty().getDefinition().getMax()),c));
  }
}
Program: 23968
Project: 23968
Buggy source:
public void dump() throws IOException {
  ln("String_Node_Str");
  ln_i("String_Node_Str");
  ln("String_Node_Str");
  ln("String_Node_Str");
  addNote();
  for (  Section s : sections) {
    ln_i("String_Node_Str");
    ln("String_Node_Str" + s.title + "String_Node_Str");
    for (    Rule r : s.rules) {
      if (!r.asserts.isEmpty()) {
        ln_i("String_Node_Str" + r.name + "String_Node_Str");
        for (        Assert a : r.asserts)         ln("String_Node_Str" + Utilities.escapeXml(a.test) + "String_Node_Str"+ Utilities.escapeXml(a.message)+ "String_Node_Str");
        ln_o("String_Node_Str");
      }
    }
    ln_o("String_Node_Str");
  }
  ln_o("String_Node_Str");
  flush();
  close();
}

Fixed version (ground truth):
public void dump() throws IOException {
  ln("String_Node_Str");
  ln_i("String_Node_Str");
  ln("String_Node_Str");
  ln("String_Node_Str");
  addNote();
  for (  Section s : sections) {
    ln_i("String_Node_Str");
    ln("String_Node_Str" + Utilities.escapeXml(s.title) + "String_Node_Str");
    for (    Rule r : s.rules) {
      if (!r.asserts.isEmpty()) {
        ln_i("String_Node_Str" + Utilities.escapeXml(r.name) + "String_Node_Str");
        for (        Assert a : r.asserts)         ln("String_Node_Str" + Utilities.escapeXml(a.test) + "String_Node_Str"+ Utilities.escapeXml(a.message)+ "String_Node_Str");
        ln_o("String_Node_Str");
      }
    }
    ln_o("String_Node_Str");
  }
  ln_o("String_Node_Str");
  flush();
  close();
}
Program: 23969
Project: 23969
Buggy source:
private void validateCnt(String cnt,int errorCount,boolean json) throws Exception {
  if (TestingUtilities.context == null) {
    TestingUtilities.context=SimpleWorkerContext.fromPack("String_Node_Str");
    ((SimpleWorkerContext)TestingUtilities.context).connectToTSServer("String_Node_Str");
  }
  System.out.println("String_Node_Str");
  ByteArrayInputStream file=new ByteArrayInputStream(cnt.getBytes(Charsets.UTF_8));
  InstanceValidator val=new InstanceValidator(TestingUtilities.context);
  List<ValidationMessage> errors=new ArrayList<ValidationMessage>();
  val.validate(errors,file,json ? FhirFormat.JSON : FhirFormat.XML);
  int ec=0;
  for (  ValidationMessage m : errors) {
    if (m.getLevel() == IssueSeverity.ERROR || m.getLevel() == IssueSeverity.FATAL) {
      ec++;
      System.out.println("String_Node_Str" + m.summary());
    }
  }
  Assert.assertTrue(ec == errorCount);
  System.out.println(val.reportTimes());
}

Fixed version (ground truth):
private void validateCnt(String cnt,int errorCount,boolean json) throws Exception {
  if (TestingUtilities.context == null) {
    TestingUtilities.context=SimpleWorkerContext.fromPack("String_Node_Str");
    ((SimpleWorkerContext)TestingUtilities.context).connectToTSServer("String_Node_Str");
  }
  System.out.println("String_Node_Str");
  ByteArrayInputStream file=new ByteArrayInputStream(cnt.getBytes(Charsets.UTF_8));
  InstanceValidator val=new InstanceValidator(TestingUtilities.context);
  List<ValidationMessage> errors=new ArrayList<ValidationMessage>();
  int ec=0;
  for (  ValidationMessage m : errors) {
    if (m.getLevel() == IssueSeverity.ERROR || m.getLevel() == IssueSeverity.FATAL) {
      ec++;
      System.out.println("String_Node_Str" + m.summary());
    }
  }
  Assert.assertTrue(ec == errorCount);
}
Program: 23971
Project: 23971
Buggy source:
public ValueSetExpansionOutcome expandOnServer(ValueSet vs,String fn) throws Exception {
  if (noTerminologyServer)   return new ValueSetExpansionOutcome("String_Node_Str");
  try {
    Map<String,String> params=new HashMap<String,String>();
    params.put("String_Node_Str",Integer.toString(expandCodesLimit));
    params.put("String_Node_Str","String_Node_Str");
    params.put("String_Node_Str","String_Node_Str");
    ValueSet result=txServer.expandValueset(vs,params);
    return new ValueSetExpansionOutcome(result);
  }
 catch (  Exception e) {
    return new ValueSetExpansionOutcome("String_Node_Str" + vs.getUrl() + "String_Node_Str"+ e.getMessage());
  }
}

Fixed version (ground truth):
public ValueSetExpansionOutcome expandOnServer(ValueSet vs,String fn) throws Exception {
  if (noTerminologyServer)   return new ValueSetExpansionOutcome("String_Node_Str");
  try {
    Map<String,String> params=new HashMap<String,String>();
    params.put("String_Node_Str",Integer.toString(expandCodesLimit));
    params.put("String_Node_Str","String_Node_Str");
    params.put("String_Node_Str","String_Node_Str");
    System.out.println("String_Node_Str" + vs.getUrl());
    ValueSet result=txServer.expandValueset(vs,params);
    return new ValueSetExpansionOutcome(result);
  }
 catch (  Exception e) {
    return new ValueSetExpansionOutcome("String_Node_Str" + vs.getUrl() + "String_Node_Str"+ e.getMessage());
  }
}
Program: 23972
Project: 23972
Buggy source:
private String determineCacheId(ValueSet vs) throws Exception {
  ValueSet vsid=new ValueSet();
  vsid.setCompose(vs.getCompose());
  vsid.setLockedDate(vs.getLockedDate());
  JsonParser parser=new JsonParser();
  parser.setOutputStyle(OutputStyle.NORMAL);
  ByteArrayOutputStream b=new ByteArrayOutputStream();
  parser.compose(b,vsid);
  b.close();
  String s=new String(b.toByteArray());
  String r=Integer.toString(s.hashCode());
  return r;
}

Fixed version (ground truth):
private String determineCacheId(ValueSet vs) throws Exception {
  ValueSet vsid=new ValueSet();
  vsid.setCompose(vs.getCompose());
  vsid.setLockedDate(vs.getLockedDate());
  JsonParser parser=new JsonParser();
  parser.setOutputStyle(OutputStyle.NORMAL);
  ByteArrayOutputStream b=new ByteArrayOutputStream();
  parser.compose(b,vsid);
  b.close();
  String s=new String(b.toByteArray());
  for (  ConceptSetComponent inc : vs.getCompose().getInclude()) {
    CodeSystem cs=fetchCodeSystem(inc.getSystem());
    if (cs != null)     s=s + cacheValue(cs);
  }
  String r=Integer.toString(s.hashCode());
  return r;
}
Program: 23974
Project: 23974
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public <T extends Resource>T fetchResource(Class<T> class_,String uri){
  if (class_ == Questionnaire.class)   return (T)questionnaire;
  if (class_ == StructureDefinition.class && !uri.contains("String_Node_Str"))   uri="String_Node_Str" + uri;
  if (uri.startsWith("String_Node_Str")) {
    if (uri.contains("String_Node_Str"))     uri=uri.substring(0,uri.indexOf("String_Node_Str"));
    if (class_ == StructureDefinition.class) {
      if (structures.containsKey(uri))       return (T)structures.get(uri);
 else       return null;
    }
 else     if (class_ == ValueSet.class) {
      if (valueSets.containsKey(uri))       return (T)valueSets.get(uri);
 else       return null;
    }
 else     if (class_ == CodeSystem.class) {
      if (codeSystems.containsKey(uri))       return (T)codeSystems.get(uri);
 else       return null;
    }
 else     if (class_ == ConceptMap.class) {
      if (maps.containsKey(uri))       return (T)maps.get(uri);
 else       return null;
    }
  }
  if (class_ == null && uri.contains("String_Node_Str")) {
    return null;
  }
  throw new Error("String_Node_Str");
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public <T extends Resource>T fetchResource(Class<T> class_,String uri){
  if (class_ == Questionnaire.class)   return (T)questionnaire;
  if (class_ == StructureDefinition.class && !uri.contains("String_Node_Str"))   uri="String_Node_Str" + uri;
  if (uri.startsWith("String_Node_Str")) {
    if (uri.contains("String_Node_Str"))     uri=uri.substring(0,uri.indexOf("String_Node_Str"));
    if (class_ == StructureDefinition.class) {
      if (structures.containsKey(uri))       return (T)structures.get(uri);
 else       return null;
    }
 else     if (class_ == ValueSet.class) {
      if (valueSets.containsKey(uri))       return (T)valueSets.get(uri);
 else       return null;
    }
 else     if (class_ == CodeSystem.class) {
      if (codeSystems.containsKey(uri))       return (T)codeSystems.get(uri);
 else       return null;
    }
 else     if (class_ == ConceptMap.class) {
      if (maps.containsKey(uri))       return (T)maps.get(uri);
 else       return null;
    }
  }
  if (class_ == null && uri.contains("String_Node_Str")) {
    return null;
  }
  throw new Error("String_Node_Str" + class_.getName() + "String_Node_Str"+ uri);
}
Program: 23975
Project: 23975
Buggy source:
@Override public List<String> getResourceNames(){
  List<String> result=new ArrayList<String>();
  for (  StructureDefinition sd : structures.values()) {
    if (sd.getKind() == StructureDefinitionKind.RESOURCE && !sd.hasBaseType())     result.add(sd.getName());
  }
  Collections.sort(result);
  return result;
}

Fixed version (ground truth):
@Override public List<String> getResourceNames(){
  List<String> result=new ArrayList<String>();
  for (  StructureDefinition sd : structures.values()) {
    if (sd.getKind() == StructureDefinitionKind.RESOURCE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION)     result.add(sd.getName());
  }
  Collections.sort(result);
  return result;
}
Program: 23976
Project: 23976
Buggy source:
@Override public String primitiveValue(){
  if (isPrimitive())   return value;
 else {
    if (hasPrimitiveValue()) {
      for (      Element c : children) {
        if (c.getName().equals("String_Node_Str"))         return c.primitiveValue();
      }
    }
    return null;
  }
}

Fixed version (ground truth):
@Override public String primitiveValue(){
  if (isPrimitive())   return value;
 else {
    if (hasPrimitiveValue() && children != null) {
      for (      Element c : children) {
        if (c.getName().equals("String_Node_Str"))         return c.primitiveValue();
      }
    }
    return null;
  }
}
Program: 23977
Project: 23977
Buggy source:
public void execute() throws Exception {
  globalStart=System.nanoTime();
  initialize();
  log("String_Node_Str");
  load();
  long startTime=System.nanoTime();
  log("String_Node_Str");
  loadConformance();
  log("String_Node_Str");
  validate();
  log("String_Node_Str" + outputDir);
  generate();
  long endTime=System.nanoTime();
  clean();
  log("String_Node_Str" + presentDuration(endTime - startTime) + "String_Node_Str"+ new ValidationPresenter(context).generate(ig.getName(),errors,fileList,Utilities.path(qaDir,"String_Node_Str")));
  if (watch) {
    first=false;
    log("String_Node_Str");
    while (watch) {
      Thread.sleep(5000);
      if (load()) {
        log("String_Node_Str" + Integer.toString(changeList.size()) + (changeList.size() == 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ genTime());
        startTime=System.nanoTime();
        loadConformance();
        checkDependencies();
        validate();
        generate();
        clean();
        endTime=System.nanoTime();
        log("String_Node_Str" + presentDuration(endTime - startTime) + "String_Node_Str"+ new ValidationPresenter(context).generate(ig.getName(),errors,fileList,Utilities.path(qaDir,"String_Node_Str")));
      }
    }
  }
 else   log("String_Node_Str");
}

Fixed version (ground truth):
public void execute() throws Exception {
  globalStart=System.nanoTime();
  initialize();
  log("String_Node_Str" + Constants.VERSION + "String_Node_Str"+ Constants.REVISION);
  load();
  long startTime=System.nanoTime();
  log("String_Node_Str");
  loadConformance();
  log("String_Node_Str");
  validate();
  log("String_Node_Str" + outputDir);
  generate();
  long endTime=System.nanoTime();
  clean();
  log("String_Node_Str" + presentDuration(endTime - startTime) + "String_Node_Str"+ new ValidationPresenter(context).generate(ig.getName(),errors,fileList,Utilities.path(qaDir,"String_Node_Str")));
  if (watch) {
    first=false;
    log("String_Node_Str");
    while (watch) {
      Thread.sleep(5000);
      if (load()) {
        log("String_Node_Str" + Integer.toString(changeList.size()) + (changeList.size() == 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ genTime());
        startTime=System.nanoTime();
        loadConformance();
        checkDependencies();
        validate();
        generate();
        clean();
        endTime=System.nanoTime();
        log("String_Node_Str" + presentDuration(endTime - startTime) + "String_Node_Str"+ new ValidationPresenter(context).generate(ig.getName(),errors,fileList,Utilities.path(qaDir,"String_Node_Str")));
      }
    }
  }
 else   log("String_Node_Str");
}
Program: 23978
Project: 23978
Buggy source:
private void findRubyExe(){
  String[] paths=System.getenv("String_Node_Str").split(File.pathSeparator);
  for (  String s : paths) {
    String[] files=new File(s).list();
    if (files != null)     for (    String file : files)     if (file.equals("String_Node_Str")) {
      rubyExe=Utilities.path(s,file);
      jekyllGem=Utilities.path(s,"String_Node_Str");
      if (!(new File(jekyllGem).exists()))       throw new Error("String_Node_Str");
      return;
    }
  }
  throw new Error("String_Node_Str");
}

Fixed version (ground truth):
private void findRubyExe(){
  String[] paths=System.getenv("String_Node_Str").split(File.pathSeparator);
  for (  String s : paths) {
    String[] files=new File(s).list();
    if (files != null)     for (    String file : files)     if (file.equals("String_Node_Str")) {
      rubyExe=Utilities.path(s,file);
      jekyllGem=Utilities.path(s,"String_Node_Str");
      if (!(new File(jekyllGem).exists()))       throw new Error("String_Node_Str");
      log("String_Node_Str" + rubyExe);
      return;
    }
  }
  throw new Error("String_Node_Str");
}
Program: 23983
Project: 23983
Buggy source:
private void loadFromStream(InputStream stream) throws IOException, FHIRException {
  ZipInputStream zip=new ZipInputStream(stream);
  ZipEntry ze;
  while ((ze=zip.getNextEntry()) != null) {
    if (ze.getName().endsWith("String_Node_Str")) {
      String name=ze.getName();
      loadFromFile(zip,name);
    }
 else     loadBytes(ze.getName(),ze,zip);
    zip.closeEntry();
  }
  zip.close();
}

Fixed version (ground truth):
private void loadFromStream(InputStream stream) throws IOException, FHIRException {
  ZipInputStream zip=new ZipInputStream(stream);
  ZipEntry ze;
  while ((ze=zip.getNextEntry()) != null) {
    if (ze.getName().endsWith("String_Node_Str")) {
      String name=ze.getName();
      loadFromFile(zip,name);
    }
 else     if (ze.getName().equals("String_Node_Str")) {
      readVersionInfo(ze,zip);
    }
 else     loadBytes(ze.getName(),ze,zip);
    zip.closeEntry();
  }
  zip.close();
}
Program: 23990
Project: 23990
Buggy source:
protected void composeConsentExceptComponent(Complex parent,String parentType,String name,Consent.ExceptComponent element,int index){
  if (element == null)   return;
  Complex t;
  if (Utilities.noString(parentType))   t=parent;
 else {
    t=parent.predicate("String_Node_Str" + parentType + '.'+ name);
  }
  composeBackboneElement(t,"String_Node_Str",name,element,index);
  if (element.hasTypeElement())   composeEnum(t,"String_Node_Str","String_Node_Str",element.getTypeElement(),-1);
  if (element.hasPeriod())   composePeriod(t,"String_Node_Str","String_Node_Str",element.getPeriod(),-1);
  for (int i=0; i < element.getActor().size(); i++)   composeConsentExceptActorComponent(t,"String_Node_Str","String_Node_Str",element.getActor().get(i),i);
  for (int i=0; i < element.getAction().size(); i++)   composeCodeableConcept(t,"String_Node_Str","String_Node_Str",element.getAction().get(i),i);
  for (int i=0; i < element.getSecurityLabel().size(); i++)   composeCoding(t,"String_Node_Str","String_Node_Str",element.getSecurityLabel().get(i),i);
  for (int i=0; i < element.getPurpose().size(); i++)   composeCoding(t,"String_Node_Str","String_Node_Str",element.getPurpose().get(i),i);
  for (int i=0; i < element.getData().size(); i++)   composeConsentExceptDataComponent(t,"String_Node_Str","String_Node_Str",element.getData().get(i),i);
}

Fixed version (ground truth):
protected void composeConsentExceptComponent(Complex parent,String parentType,String name,Consent.ExceptComponent element,int index){
  if (element == null)   return;
  Complex t;
  if (Utilities.noString(parentType))   t=parent;
 else {
    t=parent.predicate("String_Node_Str" + parentType + '.'+ name);
  }
  composeBackboneElement(t,"String_Node_Str",name,element,index);
  if (element.hasTypeElement())   composeEnum(t,"String_Node_Str","String_Node_Str",element.getTypeElement(),-1);
  if (element.hasPeriod())   composePeriod(t,"String_Node_Str","String_Node_Str",element.getPeriod(),-1);
  for (int i=0; i < element.getActor().size(); i++)   composeConsentExceptActorComponent(t,"String_Node_Str","String_Node_Str",element.getActor().get(i),i);
  for (int i=0; i < element.getAction().size(); i++)   composeCodeableConcept(t,"String_Node_Str","String_Node_Str",element.getAction().get(i),i);
  for (int i=0; i < element.getSecurityLabel().size(); i++)   composeCoding(t,"String_Node_Str","String_Node_Str",element.getSecurityLabel().get(i),i);
  for (int i=0; i < element.getPurpose().size(); i++)   composeCoding(t,"String_Node_Str","String_Node_Str",element.getPurpose().get(i),i);
  for (int i=0; i < element.getClass_().size(); i++)   composeCoding(t,"String_Node_Str","String_Node_Str",element.getClass_().get(i),i);
  for (int i=0; i < element.getCode().size(); i++)   composeCoding(t,"String_Node_Str","String_Node_Str",element.getCode().get(i),i);
  for (int i=0; i < element.getData().size(); i++)   composeConsentExceptDataComponent(t,"String_Node_Str","String_Node_Str",element.getData().get(i),i);
}
Program: 23996
Project: 23996
Buggy source:
/** 
 * This is not true of bundles generally, but it is true of all the conformance bundles produced by the spec: all entries must have a fullUrl, and it must equal http://hl7.org/fhir/[type]/[id]
 * @param bnd - the bundle to check
 */
private void checkBundleURLs(Bundle bnd){
  int i=0;
  for (  BundleEntryComponent e : bnd.getEntry()) {
    i++;
    if (!e.hasFullUrl())     page.getValidationErrors().add(new ValidationMessage(Source.Publisher,IssueType.INVALID,-1,-1,"String_Node_Str" + bnd.getId(),"String_Node_Str" + Integer.toString(i),IssueSeverity.ERROR));
 else     if (!e.getFullUrl().equals("String_Node_Str" + e.getResource().getResourceType().toString() + "String_Node_Str"+ e.getResource().getId()) && e.getResource().getResourceType() != ResourceType.CodeSystem)     page.getValidationErrors().add(new ValidationMessage(Source.Publisher,IssueType.INVALID,-1,-1,"String_Node_Str" + bnd.getId(),"String_Node_Str" + Integer.toString(i) + "String_Node_Str"+ e.getFullUrl()+ "String_Node_Str"+ "String_Node_Str"+ e.getResource().getResourceType().toString()+ "String_Node_Str"+ e.getResource().getId(),IssueSeverity.ERROR));
  }
}

Fixed version (ground truth):
/** 
 * This is not true of bundles generally, but it is true of all the conformance bundles produced by the spec: all entries must have a fullUrl, and it must equal http://hl7.org/fhir/[type]/[id]
 * @param bnd - the bundle to check
 */
private void checkBundleURLs(Bundle bnd){
  int i=0;
  for (  BundleEntryComponent e : bnd.getEntry()) {
    i++;
    if (!e.hasFullUrl())     page.getValidationErrors().add(new ValidationMessage(Source.Publisher,IssueType.INVALID,-1,-1,"String_Node_Str" + bnd.getId(),"String_Node_Str" + Integer.toString(i),IssueSeverity.ERROR));
 else     if (!e.getFullUrl().endsWith("String_Node_Str" + e.getResource().getResourceType().toString() + "String_Node_Str"+ e.getResource().getId()) && e.getResource().getResourceType() != ResourceType.CodeSystem)     page.getValidationErrors().add(new ValidationMessage(Source.Publisher,IssueType.INVALID,-1,-1,"String_Node_Str" + bnd.getId(),"String_Node_Str" + Integer.toString(i) + "String_Node_Str"+ e.getFullUrl()+ "String_Node_Str"+ e.getResource().getResourceType().toString()+ "String_Node_Str"+ e.getResource().getId(),IssueSeverity.ERROR));
 else     if (!e.getFullUrl().equals("String_Node_Str" + e.getResource().getResourceType().toString() + "String_Node_Str"+ e.getResource().getId()) && e.getResource().getResourceType() != ResourceType.CodeSystem)     page.getValidationErrors().add(new ValidationMessage(Source.Publisher,IssueType.INVALID,-1,-1,"String_Node_Str" + bnd.getId(),"String_Node_Str" + Integer.toString(i) + "String_Node_Str"+ e.getFullUrl()+ "String_Node_Str",IssueSeverity.WARNING));
  }
}
Program: 23997
Project: 23997
Buggy source:
public String xref() throws FHIRException {
  StringBuilder b=new StringBuilder();
  boolean first=true;
  b.append("String_Node_Str");
  List<String> vsurls=new ArrayList<String>();
  for (  BaseConformance sd : context.allConformanceResources()) {
    if (sd instanceof ValueSet)     vsurls.add(sd.getUrl());
  }
  Collections.sort(vsurls);
  Set<String> processed=new HashSet<>();
  for (  String url : vsurls) {
    ValueSet vc=context.fetchResource(ValueSet.class,url);
    for (    ConceptSetComponent ed : vc.getCompose().getInclude())     first=addLink(b,first,vc,ed,processed);
    for (    ConceptSetComponent ed : vc.getCompose().getExclude())     first=addLink(b,first,vc,ed,processed);
  }
  if (first)   b.append("String_Node_Str");
 else   b.append("String_Node_Str");
  return b.toString();
}

Fixed version (ground truth):
public String xref() throws FHIRException {
  StringBuilder b=new StringBuilder();
  boolean first=true;
  b.append("String_Node_Str");
  List<String> vsurls=new ArrayList<String>();
  for (  BaseConformance sd : context.allConformanceResources()) {
    if (sd instanceof ValueSet)     vsurls.add(sd.getUrl());
  }
  Collections.sort(vsurls);
  Set<String> processed=new HashSet<String>();
  for (  String url : vsurls) {
    ValueSet vc=context.fetchResource(ValueSet.class,url);
    for (    ConceptSetComponent ed : vc.getCompose().getInclude())     first=addLink(b,first,vc,ed,processed);
    for (    ConceptSetComponent ed : vc.getCompose().getExclude())     first=addLink(b,first,vc,ed,processed);
  }
  if (first)   b.append("String_Node_Str");
 else   b.append("String_Node_Str");
  return b.toString();
}
Program: 23998
Project: 23998
Buggy source:
/** 
 * Given a base (snapshot) profile structure, and a differential profile, generate a new snapshot profile
 * @param base - the base structure on which the differential will be applied
 * @param differential - the differential to apply to the base
 * @param url - where the base has relative urls for profile references, these need to be converted to absolutes by prepending this URL
 * @param trimDifferential - if this is true, then the snap short generator will remove any material in the element definitions that is not different to the base
 * @return
 * @throws FHIRException 
 * @throws DefinitionException 
 * @throws Exception
 */
public void generateSnapshot(StructureDefinition base,StructureDefinition derived,String url,String profileName) throws DefinitionException, FHIRException {
  if (base == null)   throw new DefinitionException("String_Node_Str");
  if (derived == null)   throw new DefinitionException("String_Node_Str");
  if (snapshotStack.contains(derived.getUrl()))   throw new DefinitionException("String_Node_Str" + snapshotStack.toString() + "String_Node_Str");
  snapshotStack.add(derived.getUrl());
  derived.setSnapshot(new StructureDefinitionSnapshotComponent());
  System.out.println("String_Node_Str" + derived.getId());
  int baseCursor=0;
  int diffCursor=0;
  processPaths(derived.getSnapshot(),base.getSnapshot(),derived.getDifferential(),baseCursor,diffCursor,base.getSnapshot().getElement().size() - 1,derived.getDifferential().getElement().size() - 1,url,derived.getId(),null,false,base.getUrl(),null,false);
}

Fixed version (ground truth):
/** 
 * Given a base (snapshot) profile structure, and a differential profile, generate a new snapshot profile
 * @param base - the base structure on which the differential will be applied
 * @param differential - the differential to apply to the base
 * @param url - where the base has relative urls for profile references, these need to be converted to absolutes by prepending this URL
 * @param trimDifferential - if this is true, then the snap short generator will remove any material in the element definitions that is not different to the base
 * @return
 * @throws FHIRException 
 * @throws DefinitionException 
 * @throws Exception
 */
public void generateSnapshot(StructureDefinition base,StructureDefinition derived,String url,String profileName) throws DefinitionException, FHIRException {
  if (base == null)   throw new DefinitionException("String_Node_Str");
  if (derived == null)   throw new DefinitionException("String_Node_Str");
  if (snapshotStack.contains(derived.getUrl()))   throw new DefinitionException("String_Node_Str" + snapshotStack.toString() + "String_Node_Str");
  snapshotStack.add(derived.getUrl());
  derived.setSnapshot(new StructureDefinitionSnapshotComponent());
  int baseCursor=0;
  int diffCursor=0;
  processPaths(derived.getSnapshot(),base.getSnapshot(),derived.getDifferential(),baseCursor,diffCursor,base.getSnapshot().getElement().size() - 1,derived.getDifferential().getElement().size() - 1,url,derived.getId(),null,false,base.getUrl(),null,false);
}
Program: 23999
Project: 23999
Buggy source:
public static boolean hasOID(ValueSet vs){
  return hasExtension(vs,EXT_OID);
}

Fixed version (ground truth):
public static boolean hasOID(CodeSystem cs){
  return hasExtension(cs,EXT_OID);
}
Program: 24007
Project: 24007
Buggy source:
protected void composeOrganizationInner(Organization element) throws IOException {
  composeDomainResourceElements(element);
  if (element.hasIdentifier()) {
    openArray("String_Node_Str");
    for (    Identifier e : element.getIdentifier())     composeIdentifier(null,e);
    closeArray();
  }
  ;
  if (element.hasActiveElement()) {
    composeBooleanCore("String_Node_Str",element.getActiveElement(),false);
    composeBooleanExtras("String_Node_Str",element.getActiveElement(),false);
  }
  if (element.hasType()) {
    composeCodeableConcept("String_Node_Str",element.getType());
  }
  if (element.hasNameElement()) {
    composeStringCore("String_Node_Str",element.getNameElement(),false);
    composeStringExtras("String_Node_Str",element.getNameElement(),false);
  }
  if (element.hasTelecom()) {
    openArray("String_Node_Str");
    for (    ContactPoint e : element.getTelecom())     composeContactPoint(null,e);
    closeArray();
  }
  ;
  if (element.hasAddress()) {
    openArray("String_Node_Str");
    for (    Address e : element.getAddress())     composeAddress(null,e);
    closeArray();
  }
  ;
  if (element.hasPartOf()) {
    composeReference("String_Node_Str",element.getPartOf());
  }
  if (element.hasContact()) {
    openArray("String_Node_Str");
    for (    Organization.OrganizationContactComponent e : element.getContact())     composeOrganizationOrganizationContactComponent(null,e);
    closeArray();
  }
  ;
}

Fixed version (ground truth):
protected void composeOrganizationInner(Organization element) throws IOException {
  composeDomainResourceElements(element);
  if (element.hasIdentifier()) {
    openArray("String_Node_Str");
    for (    Identifier e : element.getIdentifier())     composeIdentifier(null,e);
    closeArray();
  }
  ;
  if (element.hasActiveElement()) {
    composeBooleanCore("String_Node_Str",element.getActiveElement(),false);
    composeBooleanExtras("String_Node_Str",element.getActiveElement(),false);
  }
  if (element.hasType()) {
    composeCodeableConcept("String_Node_Str",element.getType());
  }
  if (element.hasNameElement()) {
    composeStringCore("String_Node_Str",element.getNameElement(),false);
    composeStringExtras("String_Node_Str",element.getNameElement(),false);
  }
  if (element.hasTelecom()) {
    openArray("String_Node_Str");
    for (    ContactPoint e : element.getTelecom())     composeContactPoint(null,e);
    closeArray();
  }
  ;
  if (element.hasAddress()) {
    openArray("String_Node_Str");
    for (    Address e : element.getAddress())     composeAddress(null,e);
    closeArray();
  }
  ;
  if (element.hasPartOf()) {
    composeReference("String_Node_Str",element.getPartOf());
  }
  if (element.hasContact()) {
    openArray("String_Node_Str");
    for (    Organization.OrganizationContactComponent e : element.getContact())     composeOrganizationOrganizationContactComponent(null,e);
    closeArray();
  }
  ;
  if (element.hasEndpoint()) {
    openArray("String_Node_Str");
    for (    Reference e : element.getEndpoint())     composeReference(null,e);
    closeArray();
  }
  ;
}
Program: 24011
Project: 24011
Buggy source:
protected void composeOrganization(Complex parent,String parentType,String name,Organization element,int index){
  if (element == null)   return;
  Complex t;
  if (Utilities.noString(parentType))   t=parent;
 else {
    t=parent.predicate("String_Node_Str" + parentType + '.'+ name);
  }
  composeDomainResource(t,"String_Node_Str",name,element,index);
  for (int i=0; i < element.getIdentifier().size(); i++)   composeIdentifier(t,"String_Node_Str","String_Node_Str",element.getIdentifier().get(i),i);
  if (element.hasActiveElement())   composeBoolean(t,"String_Node_Str","String_Node_Str",element.getActiveElement(),-1);
  if (element.hasType())   composeCodeableConcept(t,"String_Node_Str","String_Node_Str",element.getType(),-1);
  if (element.hasNameElement())   composeString(t,"String_Node_Str","String_Node_Str",element.getNameElement(),-1);
  for (int i=0; i < element.getTelecom().size(); i++)   composeContactPoint(t,"String_Node_Str","String_Node_Str",element.getTelecom().get(i),i);
  for (int i=0; i < element.getAddress().size(); i++)   composeAddress(t,"String_Node_Str","String_Node_Str",element.getAddress().get(i),i);
  if (element.hasPartOf())   composeReference(t,"String_Node_Str","String_Node_Str",element.getPartOf(),-1);
  for (int i=0; i < element.getContact().size(); i++)   composeOrganizationOrganizationContactComponent(t,"String_Node_Str","String_Node_Str",element.getContact().get(i),i);
}

Fixed version (ground truth):
protected void composeOrganization(Complex parent,String parentType,String name,Organization element,int index){
  if (element == null)   return;
  Complex t;
  if (Utilities.noString(parentType))   t=parent;
 else {
    t=parent.predicate("String_Node_Str" + parentType + '.'+ name);
  }
  composeDomainResource(t,"String_Node_Str",name,element,index);
  for (int i=0; i < element.getIdentifier().size(); i++)   composeIdentifier(t,"String_Node_Str","String_Node_Str",element.getIdentifier().get(i),i);
  if (element.hasActiveElement())   composeBoolean(t,"String_Node_Str","String_Node_Str",element.getActiveElement(),-1);
  if (element.hasType())   composeCodeableConcept(t,"String_Node_Str","String_Node_Str",element.getType(),-1);
  if (element.hasNameElement())   composeString(t,"String_Node_Str","String_Node_Str",element.getNameElement(),-1);
  for (int i=0; i < element.getTelecom().size(); i++)   composeContactPoint(t,"String_Node_Str","String_Node_Str",element.getTelecom().get(i),i);
  for (int i=0; i < element.getAddress().size(); i++)   composeAddress(t,"String_Node_Str","String_Node_Str",element.getAddress().get(i),i);
  if (element.hasPartOf())   composeReference(t,"String_Node_Str","String_Node_Str",element.getPartOf(),-1);
  for (int i=0; i < element.getContact().size(); i++)   composeOrganizationOrganizationContactComponent(t,"String_Node_Str","String_Node_Str",element.getContact().get(i),i);
  for (int i=0; i < element.getEndpoint().size(); i++)   composeReference(t,"String_Node_Str","String_Node_Str",element.getEndpoint().get(i),i);
}
Program: 24014
Project: 24014
Buggy source:
public static org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent tgt=new org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent();
  copyElement(src,tgt);
  tgt.setText(src.getText());
  tgt.setTiming(convertTiming(src.getTiming()));
  tgt.setAsNeeded(convertType(src.getAsNeeded()));
  tgt.setSite(convertType(src.getSite()));
  tgt.setRoute(convertCodeableConcept(src.getRoute()));
  tgt.setMethod(convertCodeableConcept(src.getMethod()));
  tgt.setQuantity(convertType(src.getQuantity()));
  tgt.setRate(convertType(src.getRate()));
  tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
  return tgt;
}

Fixed version (ground truth):
public static org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent tgt=new org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent();
  copyElement(src,tgt);
  tgt.setText(src.getText());
  tgt.setTiming(convertTiming(src.getTiming()));
  tgt.setAsNeeded(convertType(src.getAsNeeded()));
  tgt.setSite(convertType(src.getSite()));
  tgt.setRoute(convertCodeableConcept(src.getRoute()));
  tgt.setMethod(convertCodeableConcept(src.getMethod()));
  tgt.setRate(convertType(src.getRate()));
  tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
  return tgt;
}
Program: 24015
Project: 24015
Buggy source:
public static org.hl7.fhir.dstu2.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu3.model.MedicationStatement src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.MedicationStatement tgt=new org.hl7.fhir.dstu2.model.MedicationStatement();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setStatus(convertMedicationStatementStatus(src.getStatus()));
  tgt.setMedication(convertType(src.getMedication()));
  tgt.setPatient(convertReference(src.getPatient()));
  tgt.setEffective(convertType(src.getEffective()));
  tgt.setInformationSource(convertReference(src.getInformationSource()));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation())   tgt.addSupportingInformation(convertReference(t));
  tgt.setDateAsserted(src.getDateAsserted());
  tgt.setWasNotTaken(src.getWasNotTaken());
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotTaken())   tgt.addReasonNotTaken(convertCodeableConcept(t));
  tgt.setReasonForUse(convertType(src.getReasonForUse()));
  for (  org.hl7.fhir.dstu3.model.Annotation t : src.getNote())   tgt.setNote(t.getText());
  for (  org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage())   tgt.addDosage(convertMedicationStatementDosageComponent(t));
  return tgt;
}

Fixed version (ground truth):
public static org.hl7.fhir.dstu2.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu3.model.MedicationStatement src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.MedicationStatement tgt=new org.hl7.fhir.dstu2.model.MedicationStatement();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setStatus(convertMedicationStatementStatus(src.getStatus()));
  tgt.setMedication(convertType(src.getMedication()));
  tgt.setPatient(convertReference(src.getPatient()));
  tgt.setEffective(convertType(src.getEffective()));
  tgt.setInformationSource(convertReference(src.getInformationSource()));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation())   tgt.addSupportingInformation(convertReference(t));
  tgt.setDateAsserted(src.getDateAsserted());
  tgt.setWasNotTaken(src.getWasNotTaken());
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotTaken())   tgt.addReasonNotTaken(convertCodeableConcept(t));
  for (  org.hl7.fhir.dstu3.model.Annotation t : src.getNote())   tgt.setNote(t.getText());
  for (  org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage())   tgt.addDosage(convertMedicationStatementDosageComponent(t));
  return tgt;
}
Program: 24017
Project: 24017
Buggy source:
public static org.hl7.fhir.dstu2.model.Goal convertGoal(org.hl7.fhir.dstu3.model.Goal src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.Goal tgt=new org.hl7.fhir.dstu2.model.Goal();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setSubject(convertReference(src.getSubject()));
  tgt.setStart(convertType(src.getStart()));
  tgt.setTarget(convertType(src.getTarget()));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory())   tgt.addCategory(convertCodeableConcept(t));
  tgt.setDescription(src.getDescription());
  tgt.setStatus(convertGoalStatus(src.getStatus()));
  tgt.setStatusDate(src.getStatusDate());
  tgt.setStatusReason(convertCodeableConcept(src.getStatusReason()));
  tgt.setAuthor(convertReference(src.getAuthor()));
  tgt.setPriority(convertCodeableConcept(src.getPriority()));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getAddresses())   tgt.addAddresses(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.Annotation t : src.getNote())   tgt.addNote(convertAnnotation(t));
  for (  org.hl7.fhir.dstu3.model.Goal.GoalOutcomeComponent t : src.getOutcome())   tgt.addOutcome(convertGoalOutcomeComponent(t));
  return tgt;
}

Fixed version (ground truth):
public static org.hl7.fhir.dstu2.model.Goal convertGoal(org.hl7.fhir.dstu3.model.Goal src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.Goal tgt=new org.hl7.fhir.dstu2.model.Goal();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setSubject(convertReference(src.getSubject()));
  tgt.setStart(convertType(src.getStart()));
  tgt.setTarget(convertType(src.getTarget()));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory())   tgt.addCategory(convertCodeableConcept(t));
  tgt.setDescription(src.getDescription());
  tgt.setStatus(convertGoalStatus(src.getStatus()));
  tgt.setStatusDate(src.getStatusDate());
  tgt.setStatusReason(convertCodeableConcept(src.getStatusReason()));
  tgt.setPriority(convertCodeableConcept(src.getPriority()));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getAddresses())   tgt.addAddresses(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.Annotation t : src.getNote())   tgt.addNote(convertAnnotation(t));
  for (  org.hl7.fhir.dstu3.model.Goal.GoalOutcomeComponent t : src.getOutcome())   tgt.addOutcome(convertGoalOutcomeComponent(t));
  return tgt;
}
Program: 24018
Project: 24018
Buggy source:
public static org.hl7.fhir.dstu2.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu3.model.SupplyRequest src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.SupplyRequest tgt=new org.hl7.fhir.dstu2.model.SupplyRequest();
  copyDomainResource(src,tgt);
  tgt.setPatient(convertReference(src.getPatient()));
  tgt.setSource(convertReference(src.getSource()));
  tgt.setDate(src.getDate());
  tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
  tgt.setStatus(convertSupplyRequestStatus(src.getStatus()));
  tgt.setKind(convertCodeableConcept(src.getKind()));
  tgt.setOrderedItem(convertReference(src.getOrderedItem()));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getSupplier())   tgt.addSupplier(convertReference(t));
  tgt.setReason(convertType(src.getReason()));
  tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen()));
  return tgt;
}

Fixed version (ground truth):
public static org.hl7.fhir.dstu2.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu3.model.SupplyRequest src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.SupplyRequest tgt=new org.hl7.fhir.dstu2.model.SupplyRequest();
  copyDomainResource(src,tgt);
  tgt.setPatient(convertReference(src.getPatient()));
  tgt.setSource(convertReference(src.getSource()));
  tgt.setDate(src.getDate());
  tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
  tgt.setStatus(convertSupplyRequestStatus(src.getStatus()));
  tgt.setKind(convertCodeableConcept(src.getKind()));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getSupplier())   tgt.addSupplier(convertReference(t));
  tgt.setReason(convertType(src.getReason()));
  tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen()));
  return tgt;
}
Program: 24019
Project: 24019
Buggy source:
public static org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt=new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent();
  copyElement(src,tgt);
  tgt.setType(convertCodeableConcept(src.getType()));
  tgt.setReason(convertCodeableConcept(src.getReason()));
  return tgt;
}

Fixed version (ground truth):
public static org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt=new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent();
  copyElement(src,tgt);
  tgt.setReason(convertCodeableConcept(src.getReason()));
  return tgt;
}
Program: 24020
Project: 24020
Buggy source:
private static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException {
  if (src == null)   return null;
switch (src) {
case DATATYPE:
    return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE;
case RESOURCE:
  return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.RESOURCE;
case LOGICAL:
return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.LOGICAL;
default :
return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.NULL;
}
}

Fixed version (ground truth):
private static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException {
  if (src == null)   return null;
switch (src) {
case PRIMITIVETYPE:
    return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE;
case COMPLEXTYPE:
  return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE;
case RESOURCE:
return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.RESOURCE;
case LOGICAL:
return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.LOGICAL;
default :
return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.NULL;
}
}
Program: 24021
Project: 24021
Buggy source:
public static org.hl7.fhir.dstu2.model.EligibilityResponse convertEligibilityResponse(org.hl7.fhir.dstu3.model.EligibilityResponse src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.EligibilityResponse tgt=new org.hl7.fhir.dstu2.model.EligibilityResponse();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  if (src.hasRequestReference())   tgt.setRequest((org.hl7.fhir.dstu2.model.Reference)convertType(src.getRequest()));
  tgt.setOutcome(convertRemittanceOutcome(src.getOutcome()));
  tgt.setDisposition(src.getDisposition());
  tgt.setRuleset(convertCoding(src.getRuleset()));
  tgt.setOriginalRuleset(convertCoding(src.getOriginalRuleset()));
  tgt.setCreated(src.getCreated());
  if (src.hasOrganization())   tgt.setOrganization((org.hl7.fhir.dstu2.model.Reference)convertType(src.getOrganization()));
  if (src.hasRequestProvider())   tgt.setRequestProvider((org.hl7.fhir.dstu2.model.Reference)convertType(src.getRequestProvider()));
  if (src.hasRequestOrganization())   tgt.setRequestOrganization((org.hl7.fhir.dstu2.model.Reference)convertType(src.getRequestOrganization()));
  return tgt;
}

Fixed version (ground truth):
public static org.hl7.fhir.dstu2.model.EligibilityResponse convertEligibilityResponse(org.hl7.fhir.dstu3.model.EligibilityResponse src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.EligibilityResponse tgt=new org.hl7.fhir.dstu2.model.EligibilityResponse();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  if (src.hasRequestReference())   tgt.setRequest((org.hl7.fhir.dstu2.model.Reference)convertType(src.getRequest()));
  tgt.setDisposition(src.getDisposition());
  tgt.setRuleset(convertCoding(src.getRuleset()));
  tgt.setOriginalRuleset(convertCoding(src.getOriginalRuleset()));
  tgt.setCreated(src.getCreated());
  if (src.hasOrganization())   tgt.setOrganization((org.hl7.fhir.dstu2.model.Reference)convertType(src.getOrganization()));
  if (src.hasRequestProvider())   tgt.setRequestProvider((org.hl7.fhir.dstu2.model.Reference)convertType(src.getRequestProvider()));
  if (src.hasRequestOrganization())   tgt.setRequestOrganization((org.hl7.fhir.dstu2.model.Reference)convertType(src.getRequestOrganization()));
  return tgt;
}