From 7ef1d159ee2bca31310d80cfa75706e6b1e31685 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Fri, 26 Nov 2021 20:17:51 -0500 Subject: [PATCH] Fix bug loading packages in non-database mode (#3199) * Add implementation * Add changelog --- .../hapi/fhir/changelog/5_7_0/3198-package-loading-woes.yaml | 5 +++++ .../main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/3198-package-loading-woes.yaml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/3198-package-loading-woes.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/3198-package-loading-woes.yaml new file mode 100644 index 00000000000..800e393f9fc --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/3198-package-loading-woes.yaml @@ -0,0 +1,5 @@ +--- +type: change +issue: 3198 +jira: SMILE-3452 +title: "Fixed a regression where packages would fail to load if HAPI-FHIR was operating in DATABASE binary storage mode." diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java index 59790c4197c..0676f12fb24 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java @@ -28,6 +28,7 @@ import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc; +import ca.uhn.fhir.jpa.binstore.NullBinaryStorageSvcImpl; import ca.uhn.fhir.jpa.dao.data.INpmPackageDao; import ca.uhn.fhir.jpa.dao.data.INpmPackageVersionDao; import ca.uhn.fhir.jpa.dao.data.INpmPackageVersionResourceDao; @@ -198,7 +199,7 @@ public class JpaPackageCache extends BasePackageCacheManager implements IHapiPac * @throws IOException */ private byte[] fetchBlobFromBinary(IBaseBinary theBinary) throws IOException { - if (myBinaryStorageSvc != null) { + if (myBinaryStorageSvc != null && !(myBinaryStorageSvc instanceof NullBinaryStorageSvcImpl)) { return myBinaryStorageSvc.fetchDataBlobFromBinary(theBinary); } else { byte[] value = BinaryUtil.getOrCreateData(myCtx, theBinary).getValue();