Program: 23692
Project: 23692
Buggy source:
public org.hl7.fhir.dstu2.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.dstu3.model.MedicationOrder src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.MedicationOrder tgt=new org.hl7.fhir.dstu2.model.MedicationOrder();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setStatus(convertMedicationOrderStatus(src.getStatus()));
  tgt.setMedication(convertType(src.getMedication()));
  tgt.setPatient(convertReference(src.getPatient()));
  tgt.setEncounter(convertReference(src.getEncounter()));
  tgt.setDateWritten(src.getDateWritten());
  tgt.setPrescriber(convertReference(src.getPrescriber()));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode())   tgt.setReason(convertCodeableConcept(t));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference())   tgt.setReason(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.Annotation t : src.getNote())   tgt.setNote(t.getText());
  for (  org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDosageInstructionComponent t : src.getDosageInstruction())   tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t));
  tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest()));
  tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution()));
  tgt.setPriorPrescription(convertReference(src.getPriorPrescription()));
  return tgt;
}

Fixed version (ground truth):
public org.hl7.fhir.dstu2.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.dstu3.model.MedicationOrder src) throws FHIRException {
  if (src == null || src.isEmpty())   return null;
  org.hl7.fhir.dstu2.model.MedicationOrder tgt=new org.hl7.fhir.dstu2.model.MedicationOrder();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setStatus(convertMedicationOrderStatus(src.getStatus()));
  tgt.setMedication(convertType(src.getMedication()));
  tgt.setPatient(convertReference(src.getPatient()));
  tgt.setEncounter(convertReference(src.getEncounter()));
  tgt.setDateWritten(src.getDateWritten());
  tgt.setPrescriber(convertReference(src.getPrescriber()));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode())   tgt.setReason(convertCodeableConcept(t));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference())   tgt.setReason(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.Annotation t : src.getNote())   tgt.setNote(t.getText());
  for (  org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDosageInstructionComponent t : src.getDosageInstruction())   tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t));
  tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest()));
  tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution()));
  tgt.setPriorPrescription(convertReference(src.getPriorPrescription()));
  return tgt;
}