From b05d4b35ea75c98df6873149eef7c770fc419461 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 24 Sep 2024 20:33:55 -0400 Subject: [PATCH] Handle tx server issue --- .../org/hl7/fhir/r5/context/BaseWorkerContext.java | 11 ++++++++--- .../org/hl7/fhir/utilities/http/ManagedWebAccess.java | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java index 001aad87f..6676b62ae 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java @@ -1276,9 +1276,9 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte } public ValidationResult validateCode(final ValidationOptions optionsArg, String path, final Coding code, final ValueSet vs, final ValidationContextCarrier ctxt) { - + ValidationOptions options = optionsArg != null ? optionsArg : ValidationOptions.defaults(); - + if (code.hasSystem()) { codeSystemsUsed.add(code.getSystem()); } @@ -1643,7 +1643,11 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte Parameters pIn = constructParameters(options, code); res = validateOnServer(tc, vs, pIn, options); } catch (Exception e) { - res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage(), null).setTxLink(txLog == null ? null : txLog.getLastId()); + issues.clear(); + OperationOutcomeIssueComponent iss = new OperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR, org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION); + iss.getDetails().setText(e.getMessage()); + issues.add(iss); + res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage(), issues).setTxLink(txLog == null ? null : txLog.getLastId()).setErrorClass(TerminologyServiceErrorClass.SERVER_ERROR); } if (cachingAllowed) { txCache.cacheValidation(cacheToken, res, TerminologyCache.PERMANENT); @@ -1779,6 +1783,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte if (options.isDisplayWarningMode()) { pin.addParameter("mode","lenient-display-validation"); } + pin.addParameter("diagnostics", true); } private boolean addDependentResources(TerminologyClientContext tc, Parameters pin, ValueSet vs) { diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/http/ManagedWebAccess.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/http/ManagedWebAccess.java index 6c90c3a44..6dfaf7a35 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/http/ManagedWebAccess.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/http/ManagedWebAccess.java @@ -64,9 +64,9 @@ public class ManagedWebAccess { } public enum WebAccessPolicy { - DIRECT, // open access to the local file system, though access can be restricted only to files under the paths in AllowedPaths - MANAGED, // no access except by the FileSystemProxyProvider - PROHIBITED, // no access at all to File() services + DIRECT, // open access to the web, though access can be restricted only to domains in AllowedDomains + MANAGED, // no access except by the IWebAccessor + PROHIBITED, // no access at all to the web } private static WebAccessPolicy accessPolicy = WebAccessPolicy.DIRECT; // for legacy reasons