Polishing
This commit is contained in:
parent
697d14a028
commit
ca0983cd85
|
@ -290,6 +290,7 @@ public class ConfigurationClassWithConditionTests {
|
||||||
@Never
|
@Never
|
||||||
@Import({ConfigurationNotCreated.class, RegistrarNotCreated.class, ImportSelectorNotCreated.class})
|
@Import({ConfigurationNotCreated.class, RegistrarNotCreated.class, ImportSelectorNotCreated.class})
|
||||||
static class ImportsNotCreated {
|
static class ImportsNotCreated {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
if (true) throw new RuntimeException();
|
if (true) throw new RuntimeException();
|
||||||
}
|
}
|
||||||
|
@ -297,12 +298,14 @@ public class ConfigurationClassWithConditionTests {
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
static class ConfigurationNotCreated {
|
static class ConfigurationNotCreated {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
if (true) throw new RuntimeException();
|
if (true) throw new RuntimeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class RegistrarNotCreated implements ImportBeanDefinitionRegistrar {
|
static class RegistrarNotCreated implements ImportBeanDefinitionRegistrar {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
if (true) throw new RuntimeException();
|
if (true) throw new RuntimeException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,16 +154,15 @@ public abstract class WebUtils {
|
||||||
String root = servletContext.getRealPath("/");
|
String root = servletContext.getRealPath("/");
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Cannot set web app root system property when WAR file is not expanded");
|
"Cannot set web app root system property when WAR file is not expanded");
|
||||||
}
|
}
|
||||||
String param = servletContext.getInitParameter(WEB_APP_ROOT_KEY_PARAM);
|
String param = servletContext.getInitParameter(WEB_APP_ROOT_KEY_PARAM);
|
||||||
String key = (param != null ? param : DEFAULT_WEB_APP_ROOT_KEY);
|
String key = (param != null ? param : DEFAULT_WEB_APP_ROOT_KEY);
|
||||||
String oldValue = System.getProperty(key);
|
String oldValue = System.getProperty(key);
|
||||||
if (oldValue != null && !StringUtils.pathEquals(oldValue, root)) {
|
if (oldValue != null && !StringUtils.pathEquals(oldValue, root)) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException("Web app root system property already set to different value: '" +
|
||||||
"Web app root system property already set to different value: '" +
|
key + "' = [" + oldValue + "] instead of [" + root + "] - " +
|
||||||
key + "' = [" + oldValue + "] instead of [" + root + "] - " +
|
"Choose unique values for the 'webAppRootKey' context-param in your web.xml files!");
|
||||||
"Choose unique values for the 'webAppRootKey' context-param in your web.xml files!");
|
|
||||||
}
|
}
|
||||||
System.setProperty(key, root);
|
System.setProperty(key, root);
|
||||||
servletContext.log("Set web app root system property: '" + key + "' = [" + root + "]");
|
servletContext.log("Set web app root system property: '" + key + "' = [" + root + "]");
|
||||||
|
|
Loading…
Reference in New Issue