NPE fixes

This commit is contained in:
Grahame Grieve 2024-11-21 20:36:18 +11:00
parent 4f99754e75
commit 284c0e5335
3 changed files with 22 additions and 3 deletions

View File

@ -1110,6 +1110,20 @@ public class Element extends Base implements NamedItem {
return null;
}
public String getExtensionString(String url) {
if (children != null) {
for (Element child : children) {
if (extensionList.contains(child.getName())) {
String u = child.getChildValue("url");
if (url.equals(u)) {
return child.getNamedChildValue("value");
}
}
}
}
return null;
}
public List<Element> getExtensions(String url) {
List<Element> list = new ArrayList<>();
if (children != null) {

View File

@ -6572,8 +6572,13 @@ public class FHIRPathEngine {
}
private ElementDefinitionMatch getElementDefinitionById(StructureDefinition sd, String ref) {
if (ref.startsWith(sd.getUrl()+"#")) {
ref = ref.replace(sd.getUrl()+"#", "#");
StructureDefinition sdt = sd;
while (sdt != null) {
if (ref.startsWith(sdt.getUrl()+"#")) {
ref = ref.replace(sdt.getUrl()+"#", "#");
break;
}
sdt = worker.fetchResource(StructureDefinition.class, sdt.getBaseDefinition());
}
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (ref.equals("#"+ed.getId())) {

View File

@ -289,7 +289,7 @@ public class BundleRenderer extends ResourceRenderer {
public static boolean allEntriesAreHistoryProvenance(List<ResourceWrapper> entries) throws UnsupportedEncodingException, FHIRException, IOException {
for (ResourceWrapper be : entries) {
if (!"Provenance".equals(be.child("resource").fhirType())) {
if (!be.has("child") || !"Provenance".equals(be.child("resource").fhirType())) {
return false;
}
}