From b2107baae4d33c3d0f91f7fa051e8edb398e084f Mon Sep 17 00:00:00 2001 From: Heinz-Dieter Conradi Date: Thu, 1 Mar 2018 10:48:30 +0100 Subject: [PATCH] Fix the server exception when validating an invalid local reference 'fetcher == null' is ok for a local reference. Unfortunately, there are now two messages with the same meaning: - one from the ProfileValidation - one from the code in this location --- .../org/hl7/fhir/r4/validation/InstanceValidator.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java index 826dacb7127..d1679a8f212 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java @@ -1563,9 +1563,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat if (pol.checkExists()) { if (we == null) { - if (fetcher == null) - throw new FHIRException("Resource resolution services not provided"); - we = fetcher.fetch(hostContext.appContext, ref); + if (fetcher == null) { + if (!refType.equals("contained")) + throw new FHIRException("Resource resolution services not provided"); + } else { + we = fetcher.fetch(hostContext.appContext, ref); + } } rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, we != null, "Unable to resolve resource '"+ref+"'"); }