Merge remote-tracking branch 'origin/master' into i18n

This commit is contained in:
patrick-werner 2020-03-10 18:18:21 +01:00
commit f5a7961ef7
2 changed files with 22 additions and 10 deletions

View File

@ -254,7 +254,17 @@ public class JsonParser extends ParserBase {
JsonElement main = object.has(name) ? object.get(name) : null; JsonElement main = object.has(name) ? object.get(name) : null;
JsonElement fork = object.has("_"+name) ? object.get("_"+name) : null; JsonElement fork = object.has("_"+name) ? object.get("_"+name) : null;
if (main != null || fork != null) { if (main != null || fork != null) {
if (property.isList() && ((main == null) || (main instanceof JsonArray)) &&((fork == null) || (fork instanceof JsonArray)) ) { 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);
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);
ok = false;
}
if (ok) {
JsonArray arr1 = (JsonArray) main; JsonArray arr1 = (JsonArray) main;
JsonArray arr2 = (JsonArray) fork; JsonArray arr2 = (JsonArray) fork;
for (int i = 0; i < Math.max(arrC(arr1), arrC(arr2)); i++) { for (int i = 0; i < Math.max(arrC(arr1), arrC(arr2)); i++) {
@ -262,10 +272,12 @@ public class JsonParser extends ParserBase {
JsonElement f = arrI(arr2, i); JsonElement f = arrI(arr2, i);
parseChildPrimitiveInstance(context, property, name, npath, m, f); parseChildPrimitiveInstance(context, property, name, npath, m, f);
} }
} else }
} else {
parseChildPrimitiveInstance(context, property, name, npath, main, fork); parseChildPrimitiveInstance(context, property, name, npath, main, fork);
} }
} }
}
private JsonElement arrI(JsonArray arr, int i) { private JsonElement arrI(JsonArray arr, int i) {
return arr == null || i >= arr.size() || arr.get(i) instanceof JsonNull ? null : arr.get(i); return arr == null || i >= arr.size() || arr.get(i) instanceof JsonNull ? null : arr.get(i);

View File

@ -324,7 +324,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
} }
} }
} }
if (TestingUtilities.context(version).isNoTerminologyServer() || !focus.has("tx-dependent")) { if (!TestingUtilities.context(version).isNoTerminologyServer() || !focus.has("tx-dependent")) {
Assert.assertEquals("Expected "+Integer.toString(java.get("errorCount").getAsInt())+" errors, but found "+Integer.toString(ec)+".", java.get("errorCount").getAsInt(), ec); Assert.assertEquals("Expected "+Integer.toString(java.get("errorCount").getAsInt())+" errors, but found "+Integer.toString(ec)+".", java.get("errorCount").getAsInt(), ec);
if (java.has("warningCount")) if (java.has("warningCount"))
Assert.assertEquals("Expected "+Integer.toString(java.get("warningCount").getAsInt())+" warnings, but found "+Integer.toString(wc)+".", java.get("warningCount").getAsInt(), wc); Assert.assertEquals("Expected "+Integer.toString(java.get("warningCount").getAsInt())+" warnings, but found "+Integer.toString(wc)+".", java.get("warningCount").getAsInt(), wc);