From 837aa319c0cf7cea7bd88409733b1f0c86541bd9 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sat, 5 Oct 2024 06:41:33 +0800 Subject: [PATCH] do not use loadPackageFromCacheOnly from outside cache manager --- .../fhir/utilities/npm/FilesystemPackageCacheManager.java | 2 +- .../src/main/java/org/hl7/fhir/validation/IgLoader.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java index 206d90782..e8eca8f80 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java @@ -472,7 +472,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple * @throws IOException If the package cannot be loaded */ @Override - public NpmPackage loadPackageFromCacheOnly(String id, String version) throws IOException { + public NpmPackage loadPackageFromCacheOnly(String id, @Nullable String version) throws IOException { if (!Utilities.noString(version) && version.startsWith("file:")) { return loadPackageFromFile(id, version.substring(5)); diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java index 9f64cdc62..22c05b678 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java @@ -518,9 +518,9 @@ public class IgLoader implements IValidationEngineLoader { if (pi != null) System.out.println(" ... Using version " + pi.version()); } else - pi = getPackageCacheManager().loadPackageFromCacheOnly(id, version); + pi = getPackageCacheManager().loadPackage(id, version); if (pi == null) { - return resolvePackage(id, version, loadInContext); + throw new FHIRException("Unable to find package "+src); } else return loadPackage(pi, loadInContext); } @@ -670,9 +670,9 @@ public class IgLoader implements IValidationEngineLoader { if (pi != null) System.out.println(" ... Using version " + pi.version()); } else - pi = getPackageCacheManager().loadPackageFromCacheOnly(id, version); + pi = getPackageCacheManager().loadPackage(id, version); if (pi == null) { - return resolvePackageForVersion(id, version); + throw new FHIRException("Unable to resolve package "+src); } else { return pi.fhirVersion(); }