Program: 23743
Project: 23743
Buggy source:
public org.hl7.fhir.dstu2.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.HealthcareService tgt=new org.hl7.fhir.dstu2.model.HealthcareService();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setProvidedBy(convertReference(src.getProvidedBy()));
  tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory()));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType())   tgt.addServiceType().setType(convertCodeableConcept(t));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) {
    if (!tgt.hasServiceType())     tgt.addServiceType();
    tgt.getServiceType().get(0).addSpecialty(convertCodeableConcept(t));
  }
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getLocation())   tgt.setLocation(convertReference(t));
  tgt.setServiceName(src.getServiceName());
  tgt.setComment(src.getComment());
  tgt.setExtraDetails(src.getExtraDetails());
  tgt.setPhoto(convertAttachment(src.getPhoto()));
  for (  org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())   tgt.addTelecom(convertContactPoint(t));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getCoverageArea())   tgt.addCoverageArea(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceProvisionCode())   tgt.addServiceProvisionCode(convertCodeableConcept(t));
  tgt.setEligibility(convertCodeableConcept(src.getEligibility()));
  tgt.setEligibilityNote(src.getEligibilityNote());
  for (  org.hl7.fhir.dstu3.model.StringType t : src.getProgramName())   tgt.addProgramName(t.getValue());
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCharacteristic())   tgt.addCharacteristic(convertCodeableConcept(t));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReferralMethod())   tgt.addReferralMethod(convertCodeableConcept(t));
  tgt.setPublicKey(src.getPublicKey());
  tgt.setAppointmentRequired(src.getAppointmentRequired());
  for (  org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime())   tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t));
  for (  org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable())   tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t));
  tgt.setAvailabilityExceptions(src.getAvailabilityExceptions());
  return tgt;
}

Fixed version (ground truth):
public org.hl7.fhir.dstu2.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException {
  if (src == null || src.isEmpty())   return null;
  org.hl7.fhir.dstu2.model.HealthcareService tgt=new org.hl7.fhir.dstu2.model.HealthcareService();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setProvidedBy(convertReference(src.getProvidedBy()));
  tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory()));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType())   tgt.addServiceType().setType(convertCodeableConcept(t));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) {
    if (!tgt.hasServiceType())     tgt.addServiceType();
    tgt.getServiceType().get(0).addSpecialty(convertCodeableConcept(t));
  }
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getLocation())   tgt.setLocation(convertReference(t));
  tgt.setServiceName(src.getServiceName());
  tgt.setComment(src.getComment());
  tgt.setExtraDetails(src.getExtraDetails());
  tgt.setPhoto(convertAttachment(src.getPhoto()));
  for (  org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())   tgt.addTelecom(convertContactPoint(t));
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getCoverageArea())   tgt.addCoverageArea(convertReference(t));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceProvisionCode())   tgt.addServiceProvisionCode(convertCodeableConcept(t));
  tgt.setEligibility(convertCodeableConcept(src.getEligibility()));
  tgt.setEligibilityNote(src.getEligibilityNote());
  for (  org.hl7.fhir.dstu3.model.StringType t : src.getProgramName())   tgt.addProgramName(t.getValue());
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCharacteristic())   tgt.addCharacteristic(convertCodeableConcept(t));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReferralMethod())   tgt.addReferralMethod(convertCodeableConcept(t));
  tgt.setPublicKey(src.getPublicKey());
  tgt.setAppointmentRequired(src.getAppointmentRequired());
  for (  org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime())   tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t));
  for (  org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable())   tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t));
  tgt.setAvailabilityExceptions(src.getAvailabilityExceptions());
  return tgt;
}