#517 Add fallback for for pre-CapabilityStatement STU3 client

This commit is contained in:
Michael Lawley 2016-11-25 12:05:59 +10:00
parent 69871bb8c2
commit f6ae22c59c
1 changed files with 11 additions and 1 deletions

View File

@ -287,7 +287,17 @@ public abstract class RestfulClientFactory implements IRestfulClientFactory {
}
@SuppressWarnings("rawtypes")
Class implementingClass = myContext.getResourceDefinition(capabilityStatementResourceName).getImplementingClass();
Class implementingClass;
try {
implementingClass = myContext.getResourceDefinition(capabilityStatementResourceName).getImplementingClass();
} catch (DataFormatException e) {
if (!myContext.getVersion().getVersion().isOlderThan(FhirVersionEnum.DSTU3) {
capabilityStatementResourceName = "Conformance";
implementingClass = myContext.getResourceDefinition(capabilityStatementResourceName).getImplementingClass();
} else {
throw e;
}
}
try {
conformance = (IBaseResource) client.fetchConformance().ofType(implementingClass).execute();
} catch (FhirClientConnectionException e) {