* 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:
parent
f58cdec1c0
commit
11e60c3825
|
@ -67,8 +67,11 @@ public class HTMLClientLogger extends BaseLogger implements ToolingClientLogger
|
|||
file.println("<p>#"+id+"</p>");
|
||||
file.println("<pre>");
|
||||
file.println(method+" "+url+" HTTP/1.0");
|
||||
for (String s : headers)
|
||||
file.println(Utilities.escapeXml(s));
|
||||
if (headers != null) {
|
||||
for (String s : headers) {
|
||||
file.println(Utilities.escapeXml(s));
|
||||
}
|
||||
}
|
||||
if (body != null) {
|
||||
file.println("");
|
||||
try {
|
||||
|
|
|
@ -543,17 +543,19 @@ public class Element extends Base {
|
|||
}
|
||||
|
||||
public Element getNamedChild(String name) {
|
||||
if (children == null)
|
||||
return null;
|
||||
Element result = null;
|
||||
for (Element child : children) {
|
||||
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)
|
||||
result = child;
|
||||
else
|
||||
throw new Error("Attempt to read a single element when there is more than one present ("+name+")");
|
||||
}
|
||||
}
|
||||
if (children == null)
|
||||
return null;
|
||||
Element result = null;
|
||||
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 (result == null)
|
||||
result = child;
|
||||
else
|
||||
throw new Error("Attempt to read a single element when there is more than one present ("+name+")");
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ public class Manager {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static Element parse(IWorkerContext context, InputStream source, FhirFormat inputFormat) throws FHIRFormatError, DefinitionException, IOException, FHIRException {
|
||||
|
|
|
@ -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"))
|
||||
return sd;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public abstract class ParserBase {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected StructureDefinition getDefinition(int line, int col, String name) throws FHIRFormatError {
|
||||
protected StructureDefinition getDefinition(int line, int col, String name) throws FHIRFormatError {
|
||||
if (name == null) {
|
||||
logError(line, col, name, IssueType.STRUCTURE, context.formatMessage(I18nConstants.THIS_CANNOT_BE_PARSED_AS_A_FHIR_OBJECT_NO_NAME), IssueSeverity.FATAL);
|
||||
return null;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
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
|
||||
if (!type.equals(resourceName) && resourceName.equals(BUNDLE)) {
|
||||
NodeStack first = getFirstEntry(stack);
|
||||
|
|
Loading…
Reference in New Issue