Program: 23604
Project: 23604
Buggy source:
public org.hl7.fhir.dstu2.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.DocumentReference tgt=new org.hl7.fhir.dstu2.model.DocumentReference();
  copyDomainResource(src,tgt);
  tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier()));
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setSubject(convertReference(src.getSubject()));
  tgt.setType(convertCodeableConcept(src.getType()));
  tgt.setClass_(convertCodeableConcept(src.getClass_()));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getAuthor())   tgt.addAuthor(convertReference(t));
  tgt.setCustodian(convertReference(src.getCustodian()));
  tgt.setAuthenticator(convertReference(src.getAuthenticator()));
  tgt.setCreated(src.getCreated());
  tgt.setIndexed(src.getIndexed());
  tgt.setStatus(convertDocumentReferenceStatus(src.getStatus()));
  tgt.setDocStatus(convertCodeableConcept(src.getDocStatus()));
  for (  org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo())   tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t));
  tgt.setDescription(src.getDescription());
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel())   tgt.addSecurityLabel(convertCodeableConcept(t));
  for (  org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent())   tgt.addContent(convertDocumentReferenceContentComponent(t));
  tgt.setContext(convertDocumentReferenceContextComponent(src.getContext()));
  return tgt;
}

Fixed version (ground truth):
public org.hl7.fhir.dstu2.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException {
  if (src == null || src.isEmpty())   return null;
  org.hl7.fhir.dstu2.model.DocumentReference tgt=new org.hl7.fhir.dstu2.model.DocumentReference();
  copyDomainResource(src,tgt);
  tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier()));
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setSubject(convertReference(src.getSubject()));
  tgt.setType(convertCodeableConcept(src.getType()));
  tgt.setClass_(convertCodeableConcept(src.getClass_()));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getAuthor())   tgt.addAuthor(convertReference(t));
  tgt.setCustodian(convertReference(src.getCustodian()));
  tgt.setAuthenticator(convertReference(src.getAuthenticator()));
  tgt.setCreated(src.getCreated());
  tgt.setIndexed(src.getIndexed());
  tgt.setStatus(convertDocumentReferenceStatus(src.getStatus()));
  tgt.setDocStatus(convertCodeableConcept(src.getDocStatus()));
  for (  org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo())   tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t));
  tgt.setDescription(src.getDescription());
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel())   tgt.addSecurityLabel(convertCodeableConcept(t));
  for (  org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent())   tgt.addContent(convertDocumentReferenceContentComponent(t));
  tgt.setContext(convertDocumentReferenceContextComponent(src.getContext()));
  return tgt;
}