Program: 23474
Project: 23474
Buggy source:
public org.hl7.fhir.dstu2.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.CarePlan tgt=new org.hl7.fhir.dstu2.model.CarePlan();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setSubject(convertReference(src.getSubject()));
  tgt.setStatus(convertCarePlanStatus(src.getStatus()));
  tgt.setContext(convertReference(src.getContext()));
  tgt.setPeriod(convertPeriod(src.getPeriod()));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getAuthor())   tgt.addAuthor(convertReference(t));
  tgt.setModified(src.getModified());
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory())   tgt.addCategory(convertCodeableConcept(t));
  tgt.setDescription(src.getDescription());
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getAddresses())   tgt.addAddresses(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getSupport())   tgt.addSupport(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan())   tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getGoal())   tgt.addGoal(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity())   tgt.addActivity(convertCarePlanActivityComponent(t));
  tgt.setNote(convertAnnotation(src.getNote()));
  return tgt;
}

Fixed version (ground truth):
public org.hl7.fhir.dstu2.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException {
  if (src == null || src.isEmpty())   return null;
  org.hl7.fhir.dstu2.model.CarePlan tgt=new org.hl7.fhir.dstu2.model.CarePlan();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setSubject(convertReference(src.getSubject()));
  tgt.setStatus(convertCarePlanStatus(src.getStatus()));
  tgt.setContext(convertReference(src.getContext()));
  tgt.setPeriod(convertPeriod(src.getPeriod()));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getAuthor())   tgt.addAuthor(convertReference(t));
  tgt.setModified(src.getModified());
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory())   tgt.addCategory(convertCodeableConcept(t));
  tgt.setDescription(src.getDescription());
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getAddresses())   tgt.addAddresses(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getSupport())   tgt.addSupport(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan())   tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getGoal())   tgt.addGoal(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity())   tgt.addActivity(convertCarePlanActivityComponent(t));
  tgt.setNote(convertAnnotation(src.getNote()));
  return tgt;
}