PathMatchingResourcePatternResolver leniently ignores non-existing root directories

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2031 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller
2009-09-30 15:04:31 +00:00
parent 06201b5eb4
commit 85159fd248
@@ -570,9 +570,19 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
* @throws IOException if directory contents could not be retrieved
*/
protected Set<File> retrieveMatchingFiles(File rootDir, String pattern) throws IOException {
if (!rootDir.exists()) {
// Silently skip non-existing directories.
if (logger.isDebugEnabled()) {
logger.debug("Skipping [" + rootDir.getAbsolutePath() + "] because it does not exist");
}
return Collections.emptySet();
}
if (!rootDir.isDirectory()) {
throw new IllegalStateException(
"Resource path [" + rootDir.getAbsolutePath() + "] does not denote a directory");
// Complain louder if it exists but is no directory.
if (logger.isWarnEnabled()) {
logger.warn("Skipping [" + rootDir.getAbsolutePath() + "] because it does not denote a directory");
}
return Collections.emptySet();
}
if (!rootDir.canRead()) {
if (logger.isWarnEnabled()) {