Skip to content

Commit b83e07f

Browse files
committed
Ignore NoSuchFileException from getJarFile() as well
Closes gh-34764
1 parent 1841ad3 commit b83e07f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import java.nio.file.FileSystems;
3737
import java.nio.file.FileVisitOption;
3838
import java.nio.file.Files;
39+
import java.nio.file.NoSuchFileException;
3940
import java.nio.file.Path;
4041
import java.util.Collections;
4142
import java.util.Enumeration;
@@ -874,9 +875,9 @@ protected Set<Resource> doFindPathMatchingJarResources(Resource rootDirResource,
874875
rootEntryPath = (jarEntry != null ? jarEntry.getName() : "");
875876
closeJarFile = !jarCon.getUseCaches();
876877
}
877-
catch (ZipException | FileNotFoundException ex) {
878+
catch (ZipException | FileNotFoundException | NoSuchFileException ex) {
878879
// Happens in case of a non-jar file or in case of a cached root directory
879-
// without specific subdirectory present, respectively.
880+
// without the specific subdirectory present, respectively.
880881
return Collections.emptySet();
881882
}
882883
}
@@ -1275,7 +1276,7 @@ private static String fixPath(String path) {
12751276
}
12761277

12771278
/**
1278-
* Return a alternative form of the resource, i.e. with or without a leading slash.
1279+
* Return an alternative form of the resource, i.e. with or without a leading slash.
12791280
* @param path the file path (with or without a leading slash)
12801281
* @return the alternative form or {@code null}
12811282
*/

0 commit comments

Comments
 (0)