processed new JsonParser errors

This commit is contained in:
patrick-werner 2020-03-10 18:36:35 +01:00
parent f5a7961ef7
commit 162341b97a
3 changed files with 12 additions and 6 deletions

View File

@ -95,7 +95,7 @@ public class JsonParser extends ParserBase {
try {
obj = JsonTrackingParser.parse(source, map);
} catch (Exception e) {
logError(-1, -1, "(document)", IssueType.INVALID, context.formatMessage(I18nConstants.ERROR_PARSING_JSON_, e.getMessage()), IssueSeverity.FATAL);
logError(-1, -1,context.formatMessage(I18nConstants.DOCUMENT), IssueType.INVALID, context.formatMessage(I18nConstants.ERROR_PARSING_JSON_, e.getMessage()), IssueSeverity.FATAL);
return null;
}
assert (map.containsKey(obj));
@ -247,7 +247,7 @@ public class JsonParser extends ParserBase {
return "a primitive property";
}
private void parseChildPrimitive(JsonObject object, Element context, Set<String> processed, Property property, String path, String name) throws FHIRException {
private void parseChildPrimitive(JsonObject object, Element element, Set<String> processed, Property property, String path, String name) throws FHIRException {
String npath = path+"."+property.getName();
processed.add(name);
processed.add("_"+name);
@ -257,11 +257,11 @@ public class JsonParser extends ParserBase {
if (property.isList()) {
boolean ok = true;
if (!(main == null || main instanceof JsonArray)) {
logError(line(main), col(main), npath, IssueType.INVALID, "This property must be an Array, not a "+describe(main), IssueSeverity.ERROR);
logError(line(main), col(main), npath, IssueType.INVALID, context.formatMessage(I18nConstants.THIS_PROPERTY_MUST_BE_AN_ARRAY_NOT_A_, describe(main)), IssueSeverity.ERROR);
ok = false;
}
if (!(fork == null || fork instanceof JsonArray)) {
logError(line(fork), col(fork), npath, IssueType.INVALID, "This base property must be an Array, not a "+describe(main), IssueSeverity.ERROR);
logError(line(fork), col(fork), npath, IssueType.INVALID, context.formatMessage(I18nConstants.THIS_BASE_PROPERTY_MUST_BE_AN_ARRAY_NOT_A_, describe(main)), IssueSeverity.ERROR);
ok = false;
}
if (ok) {
@ -270,11 +270,11 @@ public class JsonParser extends ParserBase {
for (int i = 0; i < Math.max(arrC(arr1), arrC(arr2)); i++) {
JsonElement m = arrI(arr1, i);
JsonElement f = arrI(arr2, i);
parseChildPrimitiveInstance(context, property, name, npath, m, f);
parseChildPrimitiveInstance(element, property, name, npath, m, f);
}
}
} else {
parseChildPrimitiveInstance(context, property, name, npath, main, fork);
parseChildPrimitiveInstance(element, property, name, npath, main, fork);
}
}
}

View File

@ -426,5 +426,8 @@ public class I18nConstants {
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_NO_INCLUDES_OR_EXPANSION = "Unable_to_resolve_system__value_set_has_no_includes_or_expansion";
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_EXCLUDES = "Unable_to_resolve_system__value_set_has_excludes";
public final static String UNABLE_TO_RESOLVE_SYSTEM__NO_VALUE_SET = "Unable_to_resolve_system__no_value_set";
public final static String THIS_BASE_PROPERTY_MUST_BE_AN_ARRAY_NOT_A_ = "This_base_property_must_be_an_Array_not_a_";
public final static String THIS_PROPERTY_MUST_BE_AN_ARRAY_NOT_A_ = "This_property_must_be_an_Array_not_a_";
public final static String DOCUMENT = "document";
}

View File

@ -423,5 +423,8 @@ Unable_to_resolve_system__value_set_expansion_has_multiple_systems = Unable to r
Unable_to_resolve_system__value_set_has_no_includes_or_expansion = Unable to resolve system - value set has no includes or expansion
Unable_to_resolve_system__value_set_has_excludes = Unable to resolve system - value set has excludes
Unable_to_resolve_system__no_value_set = Unable to resolve system - no value set
This_base_property_must_be_an_Array_not_a_ = This base property must be an Array, not a {0}
This_property_must_be_an_Array_not_a_ = This property must be an Array, not a {0}
document = (document)