UnknownHostException as resource-not-found for properties files
Plus first-class declaration of FileNotFoundException in Resource javadoc.
Issue: SPR-15433
(cherry picked from commit c4e0d6c)
This commit is contained in:
@@ -18,6 +18,7 @@ package org.springframework.context.annotation;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -444,9 +445,10 @@ class ConfigurationClassParser {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException ex) {
|
||||
catch (IOException ex) {
|
||||
// Resource not found when trying to open it
|
||||
if (ignoreResourceNotFound) {
|
||||
if (ignoreResourceNotFound &&
|
||||
(ex instanceof FileNotFoundException || ex instanceof UnknownHostException)) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Properties location [" + location + "] not resolvable: " + ex.getMessage());
|
||||
}
|
||||
@@ -491,6 +493,7 @@ class ConfigurationClassParser {
|
||||
this.propertySourceNames.add(name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns {@code @Import} class, considering all meta-annotations.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user