From 4287b1ae681a4c83b9faa68bdb3ec544ec1e6bdb Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 13 Dec 2019 09:25:07 +1100 Subject: [PATCH] fix NPE in IG publisher --- .../main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java | 5 +++++ .../org/hl7/fhir/utilities/validation/ValidationOptions.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java index 31f6a74d8..1447b7469 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java @@ -515,24 +515,29 @@ public abstract class BaseWorkerContext implements IWorkerContext { @Override public ValidationResult validateCode(ValidationOptions options, String system, String code, String display) { + assert options != null; Coding c = new Coding(system, code, display); return validateCode(options, c, null); } @Override public ValidationResult validateCode(ValidationOptions options, String system, String code, String display, ValueSet vs) { + assert options != null; Coding c = new Coding(system, code, display); return validateCode(options, c, vs); } @Override public ValidationResult validateCode(ValidationOptions options, String code, ValueSet vs) { + assert options != null; Coding c = new Coding(null, code, null); return validateCode(options.guessSystem(), c, vs); } @Override public ValidationResult validateCode(ValidationOptions options, Coding code, ValueSet vs) { + assert options != null; + CacheToken cacheToken = txCache != null ? txCache.generateValidationToken(options, code, vs) : null; ValidationResult res = null; if (txCache != null) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/validation/ValidationOptions.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/validation/ValidationOptions.java index 418e19df3..0fde15287 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/validation/ValidationOptions.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/validation/ValidationOptions.java @@ -69,4 +69,8 @@ public class ValidationOptions { public String toJson() { return "\"lang\":\""+language+"\", \"useServer\":\""+Boolean.toString(useServer)+"\", \"useClient\":\""+Boolean.toString(useClient)+"\", \"guessSystem\":\""+Boolean.toString(guessSystem)+"\""; } + + public static ValidationOptions defaults() { + return new ValidationOptions("en-US"); + } } \ No newline at end of file