File tree 1 file changed +18
-1
lines changed
spring-core/src/main/java/org/springframework/core/io/support
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 17
17
package org .springframework .core .io .support ;
18
18
19
19
import java .io .File ;
20
+ import java .io .FileNotFoundException ;
20
21
import java .io .IOException ;
21
22
import java .io .UncheckedIOException ;
22
23
import java .lang .module .ModuleFinder ;
@@ -786,10 +787,26 @@ protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource
786
787
// Fallback via Resource.getFile() below
787
788
}
788
789
}
790
+
789
791
if (rootPath == null ) {
790
792
// Resource.getFile() resolution as a fallback -
791
793
// for custom URI formats and custom Resource implementations
792
- rootPath = Path .of (rootDirResource .getFile ().getAbsolutePath ());
794
+ try {
795
+ rootPath = Path .of (rootDirResource .getFile ().getAbsolutePath ());
796
+ }
797
+ catch (FileNotFoundException ex ) {
798
+ if (logger .isDebugEnabled ()) {
799
+ logger .debug ("Cannot search for matching files underneath " + rootDirResource +
800
+ " in the file system: " + ex .getMessage ());
801
+ }
802
+ return result ;
803
+ }
804
+ catch (Exception ex ) {
805
+ if (logger .isInfoEnabled ()) {
806
+ logger .info ("Failed to resolve " + rootDirResource + " in the file system: " + ex );
807
+ }
808
+ return result ;
809
+ }
793
810
}
794
811
795
812
if (!Files .exists (rootPath )) {
You can’t perform that action at this time.
0 commit comments