Fix bug loading packages in non-database mode (#3199)

* Add implementation

* Add changelog
This commit is contained in:
Tadgh 2021-11-26 20:17:51 -05:00 committed by GitHub
parent 3363807931
commit 7ef1d159ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -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."

View File

@ -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.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.model.ExpungeOptions;
import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc; 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.INpmPackageDao;
import ca.uhn.fhir.jpa.dao.data.INpmPackageVersionDao; import ca.uhn.fhir.jpa.dao.data.INpmPackageVersionDao;
import ca.uhn.fhir.jpa.dao.data.INpmPackageVersionResourceDao; import ca.uhn.fhir.jpa.dao.data.INpmPackageVersionResourceDao;
@ -198,7 +199,7 @@ public class JpaPackageCache extends BasePackageCacheManager implements IHapiPac
* @throws IOException * @throws IOException
*/ */
private byte[] fetchBlobFromBinary(IBaseBinary theBinary) throws IOException { private byte[] fetchBlobFromBinary(IBaseBinary theBinary) throws IOException {
if (myBinaryStorageSvc != null) { if (myBinaryStorageSvc != null && !(myBinaryStorageSvc instanceof NullBinaryStorageSvcImpl)) {
return myBinaryStorageSvc.fetchDataBlobFromBinary(theBinary); return myBinaryStorageSvc.fetchDataBlobFromBinary(theBinary);
} else { } else {
byte[] value = BinaryUtil.getOrCreateData(myCtx, theBinary).getValue(); byte[] value = BinaryUtil.getOrCreateData(myCtx, theBinary).getValue();