Merge pull request #452 from health-validator/fix-crash-folder-in-scope

Fix validator crash when a nested folder is present in -ig <path>
This commit is contained in:
Grahame Grieve 2021-03-29 08:56:32 +10:00 committed by GitHub
commit 58055aeaa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -65,7 +65,7 @@ public class IgLoader {
public void loadIg(List<ImplementationGuide> igs, public void loadIg(List<ImplementationGuide> igs,
Map<String, byte[]> binaries, Map<String, byte[]> binaries,
String src, String src,
boolean recursive) throws IOException, FHIRException { boolean recursive) throws IOException, FHIRException {
NpmPackage npm = src.matches(FilesystemPackageCacheManager.PACKAGE_VERSION_REGEX_OPT) && !new File(src).exists() ? getPackageCacheManager().loadPackage(src, null) : null; NpmPackage npm = src.matches(FilesystemPackageCacheManager.PACKAGE_VERSION_REGEX_OPT) && !new File(src).exists() ? getPackageCacheManager().loadPackage(src, null) : null;
if (npm != null) { if (npm != null) {
@ -147,7 +147,7 @@ public class IgLoader {
* @throws IOException * @throws IOException
**/ **/
public Map<String, byte[]> loadIgSource(String src, public Map<String, byte[]> loadIgSource(String src,
boolean recursive, boolean recursive,
boolean explore) throws FHIRException, IOException { boolean explore) throws FHIRException, IOException {
// src can be one of the following: // src can be one of the following:
// - a canonical url for an ig - this will be converted to a package id and loaded into the cache // - a canonical url for an ig - this will be converted to a package id and loaded into the cache
@ -562,7 +562,7 @@ public class IgLoader {
for (File ff : f.listFiles()) { for (File ff : f.listFiles()) {
if (ff.isDirectory() && recursive) { if (ff.isDirectory() && recursive) {
res.putAll(scanDirectory(ff, true)); res.putAll(scanDirectory(ff, true));
} else if (!isIgnoreFile(ff)) { } else if (!ff.isDirectory() && !isIgnoreFile(ff)) {
Manager.FhirFormat fmt = ResourceChecker.checkIsResource(getContext(), isDebug(), ff.getAbsolutePath()); Manager.FhirFormat fmt = ResourceChecker.checkIsResource(getContext(), isDebug(), ff.getAbsolutePath());
if (fmt != null) { if (fmt != null) {
res.put(Utilities.changeFileExt(ff.getName(), "." + fmt.getExtension()), TextFile.fileToBytes(ff.getAbsolutePath())); res.put(Utilities.changeFileExt(ff.getName(), "." + fmt.getExtension()), TextFile.fileToBytes(ff.getAbsolutePath()));