Program: 23541
Project: 23541
Buggy source:
public org.hl7.fhir.dstu2.model.Patient convertPatient(org.hl7.fhir.dstu3.model.Patient src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.Patient tgt=new org.hl7.fhir.dstu2.model.Patient();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setActive(src.getActive());
  for (  org.hl7.fhir.dstu3.model.HumanName t : src.getName())   tgt.addName(convertHumanName(t));
  for (  org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())   tgt.addTelecom(convertContactPoint(t));
  tgt.setGender(convertAdministrativeGender(src.getGender()));
  tgt.setBirthDate(src.getBirthDate());
  tgt.setDeceased(convertType(src.getDeceased()));
  for (  org.hl7.fhir.dstu3.model.Address t : src.getAddress())   tgt.addAddress(convertAddress(t));
  tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus()));
  tgt.setMultipleBirth(convertType(src.getMultipleBirth()));
  for (  org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto())   tgt.addPhoto(convertAttachment(t));
  for (  org.hl7.fhir.dstu3.model.Patient.ContactComponent t : src.getContact())   tgt.addContact(convertContactComponent(t));
  tgt.setAnimal(convertAnimalComponent(src.getAnimal()));
  for (  org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent t : src.getCommunication())   tgt.addCommunication(convertPatientCommunicationComponent(t));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getGeneralPractitioner())   tgt.addCareProvider(convertReference(t));
  tgt.setManagingOrganization(convertReference(src.getManagingOrganization()));
  for (  org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent t : src.getLink())   tgt.addLink(convertPatientLinkComponent(t));
  return tgt;
}

Fixed version (ground truth):
public org.hl7.fhir.dstu2.model.Patient convertPatient(org.hl7.fhir.dstu3.model.Patient src) throws FHIRException {
  if (src == null || src.isEmpty())   return null;
  org.hl7.fhir.dstu2.model.Patient tgt=new org.hl7.fhir.dstu2.model.Patient();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setActive(src.getActive());
  for (  org.hl7.fhir.dstu3.model.HumanName t : src.getName())   tgt.addName(convertHumanName(t));
  for (  org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())   tgt.addTelecom(convertContactPoint(t));
  tgt.setGender(convertAdministrativeGender(src.getGender()));
  tgt.setBirthDate(src.getBirthDate());
  tgt.setDeceased(convertType(src.getDeceased()));
  for (  org.hl7.fhir.dstu3.model.Address t : src.getAddress())   tgt.addAddress(convertAddress(t));
  tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus()));
  tgt.setMultipleBirth(convertType(src.getMultipleBirth()));
  for (  org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto())   tgt.addPhoto(convertAttachment(t));
  for (  org.hl7.fhir.dstu3.model.Patient.ContactComponent t : src.getContact())   tgt.addContact(convertContactComponent(t));
  tgt.setAnimal(convertAnimalComponent(src.getAnimal()));
  for (  org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent t : src.getCommunication())   tgt.addCommunication(convertPatientCommunicationComponent(t));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getGeneralPractitioner())   tgt.addCareProvider(convertReference(t));
  tgt.setManagingOrganization(convertReference(src.getManagingOrganization()));
  for (  org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent t : src.getLink())   tgt.addLink(convertPatientLinkComponent(t));
  return tgt;
}