do not use loadPackageFromCacheOnly from outside cache manager

This commit is contained in:
Grahame Grieve 2024-10-05 06:41:33 +08:00
parent 0a03628e97
commit 837aa319c0
2 changed files with 5 additions and 5 deletions

View File

@ -472,7 +472,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
* @throws IOException If the package cannot be loaded * @throws IOException If the package cannot be loaded
*/ */
@Override @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:")) { if (!Utilities.noString(version) && version.startsWith("file:")) {
return loadPackageFromFile(id, version.substring(5)); return loadPackageFromFile(id, version.substring(5));

View File

@ -518,9 +518,9 @@ public class IgLoader implements IValidationEngineLoader {
if (pi != null) if (pi != null)
System.out.println(" ... Using version " + pi.version()); System.out.println(" ... Using version " + pi.version());
} else } else
pi = getPackageCacheManager().loadPackageFromCacheOnly(id, version); pi = getPackageCacheManager().loadPackage(id, version);
if (pi == null) { if (pi == null) {
return resolvePackage(id, version, loadInContext); throw new FHIRException("Unable to find package "+src);
} else } else
return loadPackage(pi, loadInContext); return loadPackage(pi, loadInContext);
} }
@ -670,9 +670,9 @@ public class IgLoader implements IValidationEngineLoader {
if (pi != null) if (pi != null)
System.out.println(" ... Using version " + pi.version()); System.out.println(" ... Using version " + pi.version());
} else } else
pi = getPackageCacheManager().loadPackageFromCacheOnly(id, version); pi = getPackageCacheManager().loadPackage(id, version);
if (pi == null) { if (pi == null) {
return resolvePackageForVersion(id, version); throw new FHIRException("Unable to resolve package "+src);
} else { } else {
return pi.fhirVersion(); return pi.fhirVersion();
} }