From f23f9204b874f53a07c13346a74a4af0c0fc07d2 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 19 Dec 2024 13:17:16 +1100 Subject: [PATCH] missed code --- .../r5/context/BaseWorkerContextTests.java | 12 +- .../src/main/resources/Messages.properties | 6 +- .../validation/instance/utils/UrlUtil.java | 7 +- .../4.0.1/mimetypes.cache | 112 ++++++++++++++++++ pom.xml | 2 +- 5 files changed, 128 insertions(+), 11 deletions(-) diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/context/BaseWorkerContextTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/context/BaseWorkerContextTests.java index c4f3e0872..760b641e0 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/context/BaseWorkerContextTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/context/BaseWorkerContextTests.java @@ -296,7 +296,7 @@ public class BaseWorkerContextTests { public void testAddServerValidationParametersDisplayWarning() throws IOException { BaseWorkerContext baseWorkerContext = getBaseWorkerContext(); Parameters pin = new Parameters(); - baseWorkerContext.addServerValidationParameters(baseWorkerContext.getTxClientManager().getMaster(), new ValueSet(), pin, new ValidationOptions(FhirPublication.fromCode(baseWorkerContext.getVersion())).setDisplayWarningMode(true)); + baseWorkerContext.addServerValidationParameters(null, baseWorkerContext.getTxClientManager().getMaster(), new ValueSet(), pin, new ValidationOptions(FhirPublication.fromCode(baseWorkerContext.getVersion())).setDisplayWarningMode(true)); assertEquals("lenient-display-validation", pin.getParameter("mode").getValue().primitiveValue()); } @@ -304,7 +304,7 @@ public class BaseWorkerContextTests { public void testAddServerValidationParametersVsAsUrl() throws IOException { BaseWorkerContext baseWorkerContext = getBaseWorkerContext(); Parameters pin = new Parameters(); - baseWorkerContext.addServerValidationParameters(baseWorkerContext.getTxClientManager().getMaster(), new ValueSet().setUrl("http://dummy.org/vs"), pin, new ValidationOptions(FhirPublication.fromCode(baseWorkerContext.getVersion())).setVsAsUrl(true)); + baseWorkerContext.addServerValidationParameters(null, baseWorkerContext.getTxClientManager().getMaster(), new ValueSet().setUrl("http://dummy.org/vs"), pin, new ValidationOptions(FhirPublication.fromCode(baseWorkerContext.getVersion())).setVsAsUrl(true)); assertEquals("uri", pin.getParameter("url").getValue().fhirType()); assertEquals("http://dummy.org/vs", pin.getParameter("url").getValue().primitiveValue()); } @@ -314,7 +314,7 @@ public class BaseWorkerContextTests { BaseWorkerContext baseWorkerContext = getBaseWorkerContext(); Parameters pin = new Parameters(); - baseWorkerContext.addServerValidationParameters(baseWorkerContext.getTxClientManager().getMaster(), new ValueSet(), pin, new ValidationOptions(FhirPublication.fromCode(baseWorkerContext.getVersion()))); + baseWorkerContext.addServerValidationParameters(null, baseWorkerContext.getTxClientManager().getMaster(), new ValueSet(), pin, new ValidationOptions(FhirPublication.fromCode(baseWorkerContext.getVersion()))); assertNull(pin.getParameter("mode")); } @@ -460,7 +460,7 @@ public class BaseWorkerContextTests { Mockito.doReturn(cacheToken).when(terminologyCache).generateExpandToken(argThat(new ValueSetMatcher(vs)),eq(true)); Mockito.doReturn(expectedExpansionResult).when(terminologyCache).getExpansion(cacheToken); - ValueSetExpansionOutcome actualExpansionResult = context.expandVS(inc, true, false); + ValueSetExpansionOutcome actualExpansionResult = context.expandVS(null, inc, true, false); assertEquals(expectedExpansionResult, actualExpansionResult); @@ -484,14 +484,14 @@ public class BaseWorkerContextTests { TerminologyClientContext terminologyClientContext = context.getTxClientManager().getMaster(); - Mockito.doReturn(expParameters).when(context).constructParameters(argThat(new TerminologyClientContextMatcher(terminologyClientContext)),argThat(new ValueSetMatcher(vs)), eq(true)); + Mockito.doReturn(expParameters).when(context).constructParameters(argThat(null), argThat(new TerminologyClientContextMatcher(terminologyClientContext)),argThat(new ValueSetMatcher(vs)), eq(true)); ValueSet expectedValueSet = new ValueSet(); Mockito.doReturn(expectedValueSet).when(terminologyClient).expandValueset(argThat(new ValueSetMatcher(vs)), argThat(new ParametersMatcher(pInWithDependentResources))); - ValueSetExpansionOutcome actualExpansionResult = context.expandVS(inc, true, false); + ValueSetExpansionOutcome actualExpansionResult = context.expandVS(null, inc, true, false); assertEquals(expectedValueSet, actualExpansionResult.getValueset()); diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages.properties b/org.hl7.fhir.utilities/src/main/resources/Messages.properties index 52ad940aa..8aeb73438 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages.properties @@ -190,7 +190,7 @@ ED_CONTEXT_INVARIANT_EXPRESSION_ERROR = Error in constraint ''{0}'': {1} ED_INVARIANT_DIFF_NO_SOURCE = The invariant {0} defined in the differential must have no source, or the source must be the same as the profile ED_INVARIANT_EXPRESSION_CONFLICT = The constraint ''{0}'' has an expression ''{1}'', which differs from the earlier expression provided of ''{2}'' (invariants are allowed to repeat, but cannot differ) ED_INVARIANT_EXPRESSION_ERROR = Error in constraint ''{0}'' with expression ''{1}'': {2} -ED_INVARIANT_KEY_ALREADY_USED = The constraint key ''{0}'' already exists in the base profile ''{1}'' +ED_INVARIANT_KEY_ALREADY_USED = The constraint key ''{0}'' already exists at the location ''{1}'' with a different expression (''{2}'') ED_INVARIANT_NO_EXPRESSION = The constraint ''{0}'' has no computable expression, so validators will not be able to check it ED_INVARIANT_NO_KEY = The constraint has no key, so the content cannot be validated ED_PATH_WRONG_TYPE_MATCH = The path must be ''{0}'' not ''{1}'' when the type list is not constrained @@ -1075,8 +1075,8 @@ XHTML_URL_DATA_MIMETYPE = The mimetype portion of the data: URL is not valid ({1 XHTML_URL_DATA_NO_DATA = No data found in data: URL XHTML_URL_EMPTY = URL is empty XHTML_URL_INVALID = The URL is not valid because ''({1})'': {0} -XHTML_URL_INVALID_CHARS_one = URL contains Invalid Character ({1}) -XHTML_URL_INVALID_CHARS_other = URL contains {0} Invalid Characters ({1}) +XHTML_URL_INVALID_CHARS_one = URL contains Invalid Character: {1} +XHTML_URL_INVALID_CHARS_other = URL contains {0} Invalid Characters: {1} XHTML_XHTML_Attribute_Illegal = Invalid attribute name in the XHTML (''{0}'' on ''{1}'') XHTML_XHTML_DOCTYPE_ILLEGAL = Malformed XHTML: Found a DocType declaration, and these are not allowed (XXE security vulnerability protection) XHTML_XHTML_ELEMENT_ILLEGAL_IN_PARA = Invalid element name inside a paragraph in the XHTML (''{0}'') diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/utils/UrlUtil.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/utils/UrlUtil.java index 2568c4640..a843e4597 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/utils/UrlUtil.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/utils/UrlUtil.java @@ -5,6 +5,7 @@ import java.util.Set; import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.utilities.i18n.I18nConstants; +import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.validation.instance.utils.Base64Util; @@ -50,7 +51,11 @@ public class UrlUtil { if (invalidChars.isEmpty()) { return null; } else { - return context.formatMessagePlural(c, I18nConstants.XHTML_URL_INVALID_CHARS, invalidChars.toString()); + Set ss = new HashSet<>(); + for (Character ch : invalidChars) { + ss.add("'"+ch.toString()+"'"); + } + return context.formatMessagePlural(c, I18nConstants.XHTML_URL_INVALID_CHARS, CommaSeparatedStringBuilder.join(",", Utilities.sorted(ss))); } } } diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/mimetypes.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/mimetypes.cache index 055682d8e..12b6b53d8 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/mimetypes.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/mimetypes.cache @@ -13,3 +13,115 @@ e: { "error" : "Error from http://tx-dev.fhir.org/r4: The code System \"urn:ietf:bcp:13\" has a grammar, and cannot be enumerated directly" } ------------------------------------------------------------------------------------- +{"hierarchical" : false, "valueSet" :{ + "resourceType" : "ValueSet", + "compose" : { + "inactive" : true, + "include" : [{ + "system" : "urn:ietf:bcp:13" + }] + } +}}#### +e: { + "from-server" : true, + "error" : "Error from http://tx-dev.fhir.org/r4: The code System \"urn:ietf:bcp:13\" has a grammar, and cannot be enumerated directly" +} +------------------------------------------------------------------------------------- +{"hierarchical" : false, "valueSet" :{ + "resourceType" : "ValueSet", + "compose" : { + "inactive" : true, + "include" : [{ + "system" : "urn:ietf:bcp:13" + }] + } +}}#### +e: { + "from-server" : true, + "error" : "Error from http://tx-dev.fhir.org/r4: The code System \"urn:ietf:bcp:13\" has a grammar, and cannot be enumerated directly" +} +------------------------------------------------------------------------------------- +{"hierarchical" : false, "valueSet" :{ + "resourceType" : "ValueSet", + "compose" : { + "inactive" : true, + "include" : [{ + "system" : "urn:ietf:bcp:13" + }] + } +}}#### +e: { + "from-server" : true, + "error" : "Error from http://tx-dev.fhir.org/r4: The code System \"urn:ietf:bcp:13\" has a grammar, and cannot be enumerated directly" +} +------------------------------------------------------------------------------------- +{"hierarchical" : false, "valueSet" :{ + "resourceType" : "ValueSet", + "compose" : { + "inactive" : true, + "include" : [{ + "system" : "urn:ietf:bcp:13" + }] + } +}}#### +e: { + "from-server" : true, + "error" : "Error from http://tx-dev.fhir.org/r4: The code System \"urn:ietf:bcp:13\" has a grammar, and cannot be enumerated directly" +} +------------------------------------------------------------------------------------- +{"hierarchical" : false, "valueSet" :{ + "resourceType" : "ValueSet", + "compose" : { + "inactive" : true, + "include" : [{ + "system" : "urn:ietf:bcp:13" + }] + } +}}#### +e: { + "from-server" : true, + "error" : "Error from http://tx-dev.fhir.org/r4: The code System \"urn:ietf:bcp:13\" has a grammar, and cannot be enumerated directly" +} +------------------------------------------------------------------------------------- +{"hierarchical" : false, "valueSet" :{ + "resourceType" : "ValueSet", + "compose" : { + "inactive" : true, + "include" : [{ + "system" : "urn:ietf:bcp:13" + }] + } +}}#### +e: { + "from-server" : true, + "error" : "Error from http://tx-dev.fhir.org/r4: The code System \"urn:ietf:bcp:13\" has a grammar, and cannot be enumerated directly" +} +------------------------------------------------------------------------------------- +{"hierarchical" : false, "valueSet" :{ + "resourceType" : "ValueSet", + "compose" : { + "inactive" : true, + "include" : [{ + "system" : "urn:ietf:bcp:13" + }] + } +}}#### +e: { + "from-server" : true, + "error" : "Error from http://tx-dev.fhir.org/r4: The code System \"urn:ietf:bcp:13\" has a grammar, and cannot be enumerated directly" +} +------------------------------------------------------------------------------------- +{"hierarchical" : false, "valueSet" :{ + "resourceType" : "ValueSet", + "compose" : { + "inactive" : true, + "include" : [{ + "system" : "urn:ietf:bcp:13" + }] + } +}}#### +e: { + "from-server" : true, + "error" : "Error from http://tx-dev.fhir.org/r4: The code System \"urn:ietf:bcp:13\" has a grammar, and cannot be enumerated directly" +} +------------------------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index c0c6faca3..eba23bb21 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 2.17.0 32.0.1-jre 6.4.1 - 1.7.1 + 1.7.2-SNAPSHOT 2.17.0 5.9.2 1.8.2