diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java index d071239d8..9b53411ff 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java @@ -2279,9 +2279,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat if (!candidateProfiles.isEmpty()) { for (String pr: candidateProfiles) { profiles.add(pr); - StructureDefinition cpr = (StructureDefinition)context.fetchResource(StructureDefinition.class, pr); List profileErrors = new ArrayList(); - doResourceProfile(hostContext, we, pr, profileErrors, stack.push(we, -1, null, null), path, element, cpr); + doResourceProfile(hostContext, we, pr, profileErrors, stack.push(we, -1, null, null), path, element, profile); if (hasErrors(profileErrors)) badProfiles.add(profileErrors); @@ -2348,10 +2347,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat private void doResourceProfile(ValidatorHostContext hostContext, Element resource, String profile, List errors, NodeStack stack, String path, Element element, StructureDefinition containingProfile) throws FHIRException, IOException { ResourceProfiles resourceProfiles = addResourceProfile(errors, resource, profile, path, element, stack, containingProfile); - if (!resourceProfiles.isProcessed()) { + if (resourceProfiles.isProcessed()) { start(hostContext, errors, resource, resource, null, stack); } - // lloyd capture errors? } private ResourceProfiles getResourceProfiles(Element resource, NodeStack stack) {