Ignore NoSuchFileException from getJarFile() as well

Closes gh-34764
This commit is contained in:
Juergen Hoeller
2025-04-22 12:17:18 +02:00
parent 1841ad3472
commit b83e07ff8c

View File

@@ -36,6 +36,7 @@ import java.nio.file.FileSystemNotFoundException;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.util.Collections;
import java.util.Enumeration;
@@ -874,9 +875,9 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
rootEntryPath = (jarEntry != null ? jarEntry.getName() : "");
closeJarFile = !jarCon.getUseCaches();
}
catch (ZipException | FileNotFoundException ex) {
catch (ZipException | FileNotFoundException | NoSuchFileException ex) {
// Happens in case of a non-jar file or in case of a cached root directory
// without specific subdirectory present, respectively.
// without the specific subdirectory present, respectively.
return Collections.emptySet();
}
}
@@ -1275,7 +1276,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
}
/**
* Return a alternative form of the resource, i.e. with or without a leading slash.
* Return an alternative form of the resource, i.e. with or without a leading slash.
* @param path the file path (with or without a leading slash)
* @return the alternative form or {@code null}
*/