* fix NPE bug logging terminology server calls

* fix NPE bug validating logical models
* fix problem with Type Name when validating against Logical Models
This commit is contained in:
Grahame Grieve 2021-09-02 06:27:06 +10:00
parent f58cdec1c0
commit 11e60c3825
5 changed files with 22 additions and 16 deletions

View File

@ -67,8 +67,11 @@ public class HTMLClientLogger extends BaseLogger implements ToolingClientLogger
file.println("<p>#"+id+"</p>"); file.println("<p>#"+id+"</p>");
file.println("<pre>"); file.println("<pre>");
file.println(method+" "+url+" HTTP/1.0"); file.println(method+" "+url+" HTTP/1.0");
for (String s : headers) if (headers != null) {
for (String s : headers) {
file.println(Utilities.escapeXml(s)); file.println(Utilities.escapeXml(s));
}
}
if (body != null) { if (body != null) {
file.println(""); file.println("");
try { try {

View File

@ -547,12 +547,14 @@ public class Element extends Base {
return null; return null;
Element result = null; Element result = null;
for (Element child : children) { for (Element child : children) {
if (child.getName() != null && name != null && child.getProperty() != null && child.getProperty().getDefinition() != null && child.fhirType() != null) {
if (child.getName().equals(name) || (child.getName().length() > child.fhirType().length() && child.getName().substring(0, child.getName().length() - child.fhirType().length()).equals(name) && child.getProperty().getDefinition().isChoice())) { if (child.getName().equals(name) || (child.getName().length() > child.fhirType().length() && child.getName().substring(0, child.getName().length() - child.fhirType().length()).equals(name) && child.getProperty().getDefinition().isChoice())) {
if (result == null) if (result == null)
result = child; result = child;
else else
throw new Error("Attempt to read a single element when there is more than one present ("+name+")"); throw new Error("Attempt to read a single element when there is more than one present ("+name+")");
} }
}
} }
return result; return result;
} }

View File

@ -79,6 +79,7 @@ public class Manager {
return null; return null;
} }
} }
public static Element parse(IWorkerContext context, InputStream source, FhirFormat inputFormat) throws FHIRFormatError, DefinitionException, IOException, FHIRException { public static Element parse(IWorkerContext context, InputStream source, FhirFormat inputFormat) throws FHIRFormatError, DefinitionException, IOException, FHIRException {

View File

@ -114,7 +114,7 @@ public abstract class ParserBase {
if(name.equals(sd.getType()) && (ns == null || ns.equals(FormatUtilities.FHIR_NS)) && !ToolingExtensions.hasExtension(sd, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace")) if(name.equals(sd.getType()) && (ns == null || ns.equals(FormatUtilities.FHIR_NS)) && !ToolingExtensions.hasExtension(sd, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))
return sd; return sd;
String sns = ToolingExtensions.readStringExtension(sd, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"); String sns = ToolingExtensions.readStringExtension(sd, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
if (name.equals(sd.getType()) && ns != null && ns.equals(sns)) if ((name.equals(sd.getType()) || name.equals(sd.getName())) ) && ns != null && ns.equals(sns))
return sd; return sd;
} }
} }

View File

@ -5170,7 +5170,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
ok = rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), defn != null, I18nConstants.VALIDATION_VAL_PROFILE_NODEFINITION, resourceName); ok = rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), defn != null, I18nConstants.VALIDATION_VAL_PROFILE_NODEFINITION, resourceName);
} }
String type = defn.getKind() == StructureDefinitionKind.LOGICAL ? defn.getId() : defn.getType(); String type = defn.getKind() == StructureDefinitionKind.LOGICAL ? defn.getName() : defn.getType();
// special case: we have a bundle, and the profile is not for a bundle. We'll try the first entry instead // special case: we have a bundle, and the profile is not for a bundle. We'll try the first entry instead
if (!type.equals(resourceName) && resourceName.equals(BUNDLE)) { if (!type.equals(resourceName) && resourceName.equals(BUNDLE)) {
NodeStack first = getFirstEntry(stack); NodeStack first = getFirstEntry(stack);