diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java index 5b1da0fb1..9a066cfec 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java @@ -696,7 +696,7 @@ public class ProfileDrivenRenderer extends ResourceRenderer { } private boolean isBase(String code) { - return code.equals("Element") || code.equals("BackboneElement"); + return code != null && (code.equals("Element") || code.equals("BackboneElement")); } private List getChildrenForPath(StructureDefinition profile, List elements, String path) throws DefinitionException { @@ -1008,7 +1008,11 @@ public class ProfileDrivenRenderer extends ResourceRenderer { // we're going to split these up, and create a property for each url if (p.hasValues()) { for (BaseWrapper v : p.getValues()) { - Extension ex = (Extension) v.getBase(); + Base b = v.getBase(); + if (!(b instanceof Extension)) { + throw new FHIRException("huh?"); + } + Extension ex = (Extension) b; String url = ex.getUrl(); StructureDefinition ed = getContext().getWorker().fetchResource(StructureDefinition.class, url); if (ed == null) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/ElementWrappers.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/ElementWrappers.java index e44572dd8..909819493 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/ElementWrappers.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/ElementWrappers.java @@ -69,7 +69,7 @@ public class ElementWrappers { try { return context.getParser().parseType(xml.toString(StandardCharsets.UTF_8), type); } catch (Exception e) { - return new StringType("Illegal syntax: "+e.getMessage()); + throw new FHIRException(e.getMessage(), e); } } }