Commit 12a7df6c authored by Dave Syer's avatar Dave Syer

Be defensive about classloader in MessageSourceAutoConfiguration

Fixes gh-1960
parent d0f43d2e
......@@ -137,7 +137,7 @@ public class MessageSourceAutoConfiguration {
return new SkipPatternPathMatchingResourcePatternResolver(classLoader)
.getResources("classpath*:" + name + "*.properties");
}
catch (IOException ex) {
catch (Exception ex) {
return NO_RESOURCES;
}
}
......@@ -153,10 +153,15 @@ public class MessageSourceAutoConfiguration {
private static final ClassLoader ROOT_CLASSLOADER;
static {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
ClassLoader classLoader = null;
try {
classLoader = ClassLoader.getSystemClassLoader();
while (classLoader.getParent() != null) {
classLoader = classLoader.getParent();
}
}
catch (Throwable e) {
}
ROOT_CLASSLOADER = classLoader;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment