From 2c4b4c4ca2b6c7019c4c2c0c449bc82a4e2f9819 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 9 Dec 2020 10:04:56 +1100 Subject: [PATCH] Fix NPE reading results of batch code validation --- .../fhir/r5/context/BaseWorkerContext.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) 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 e6f1487b8..047f8143c 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 @@ -1049,23 +1049,25 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte String display = null; TerminologyServiceErrorClass err = TerminologyServiceErrorClass.UNKNOWN; for (ParametersParameterComponent p : pOut.getParameter()) { - if (p.getName().equals("result")) { - ok = ((BooleanType) p.getValue()).getValue().booleanValue(); - } else if (p.getName().equals("message")) { - message = ((StringType) p.getValue()).getValue(); - } else if (p.getName().equals("display")) { - display = ((StringType) p.getValue()).getValue(); - } else if (p.getName().equals("cause")) { - try { - IssueType it = IssueType.fromCode(((StringType) p.getValue()).getValue()); - if (it == IssueType.UNKNOWN) { - err = TerminologyServiceErrorClass.UNKNOWN; - } else if (it == IssueType.NOTFOUND) { - err = TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED; - } else if (it == IssueType.NOTSUPPORTED) { - err = TerminologyServiceErrorClass.VALUESET_UNSUPPORTED; + if (p.hasValue()) { + if (p.getName().equals("result")) { + ok = ((BooleanType) p.getValue()).getValue().booleanValue(); + } else if (p.getName().equals("message")) { + message = ((StringType) p.getValue()).getValue(); + } else if (p.getName().equals("display")) { + display = ((StringType) p.getValue()).getValue(); + } else if (p.getName().equals("cause")) { + try { + IssueType it = IssueType.fromCode(((StringType) p.getValue()).getValue()); + if (it == IssueType.UNKNOWN) { + err = TerminologyServiceErrorClass.UNKNOWN; + } else if (it == IssueType.NOTFOUND) { + err = TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED; + } else if (it == IssueType.NOTSUPPORTED) { + err = TerminologyServiceErrorClass.VALUESET_UNSUPPORTED; + } + } catch (FHIRException e) { } - } catch (FHIRException e) { } } }