diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/FHIRToolingClient.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/FHIRToolingClient.java index 1106a4def..f638c9a9b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/FHIRToolingClient.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/FHIRToolingClient.java @@ -40,6 +40,9 @@ import org.hl7.fhir.r5.utils.client.network.Client; import org.hl7.fhir.r5.utils.client.network.ResourceRequest; import org.hl7.fhir.utilities.ToolingClientLogger; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.net.URI; @@ -75,6 +78,9 @@ import java.util.stream.Stream; */ public class FHIRToolingClient { + private static final Logger logger = LoggerFactory.getLogger(FHIRToolingClient.class); + + public static final String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ssK"; public static final String DATE_FORMAT = "yyyy-MM-dd"; public static final String hostKey = "http.proxyHost"; @@ -144,7 +150,6 @@ public class FHIRToolingClient { private T getCapabilities(URI resourceUri, String message, String exceptionMessage) throws FHIRException { final List resourceFormats = getResourceFormatsWithPreferredFirst(); - FHIRException fhirException = null; for (ResourceFormat attemptedResourceFormat : resourceFormats) { try { T output = (T) client.issueGetResourceRequest(resourceUri, @@ -157,12 +162,10 @@ public class FHIRToolingClient { } return output; } catch (Exception e) { - fhirException = fhirException == null - ? new FHIRException(exceptionMessage) - : new FHIRException(exceptionMessage, fhirException); + logger.warn("Failed attempt to fetch " + resourceUri, e); } } - throw fhirException; + throw new FHIRException(exceptionMessage); } public TerminologyCapabilities getTerminologyCapabilities() { diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/utils/client/FHIRToolingClientTest.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/utils/client/FHIRToolingClientTest.java index b573573ca..8b78a92c6 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/utils/client/FHIRToolingClientTest.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/utils/client/FHIRToolingClientTest.java @@ -212,7 +212,6 @@ class FHIRToolingClientTest { assertEquals(ResourceFormat.RESOURCE_JSON.getHeader(), toolingClient.getPreferredResourceFormat()); toolingClient.setClientHeaders(getHeaders()); Exception exception = assertThrows(FHIRException.class, () -> { ArgumentCaptor headersArgumentCaptor = ArgumentCaptor.forClass(Headers.class); - toolingClient.getCapabilitiesStatement(); }); assertEquals(ResourceFormat.RESOURCE_JSON.getHeader(), toolingClient.getPreferredResourceFormat()); }