From ca0983cd850717a23b714f98dbfbb40aaebec45c Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 1 Aug 2017 12:08:57 +0200 Subject: [PATCH] Polishing --- .../annotation/ConfigurationClassWithConditionTests.java | 3 +++ .../main/java/org/springframework/web/util/WebUtils.java | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassWithConditionTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassWithConditionTests.java index 8d55a9f03f..507edec2c1 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassWithConditionTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassWithConditionTests.java @@ -290,6 +290,7 @@ public class ConfigurationClassWithConditionTests { @Never @Import({ConfigurationNotCreated.class, RegistrarNotCreated.class, ImportSelectorNotCreated.class}) static class ImportsNotCreated { + static { if (true) throw new RuntimeException(); } @@ -297,12 +298,14 @@ public class ConfigurationClassWithConditionTests { @Configuration static class ConfigurationNotCreated { + static { if (true) throw new RuntimeException(); } } static class RegistrarNotCreated implements ImportBeanDefinitionRegistrar { + static { if (true) throw new RuntimeException(); } diff --git a/spring-web/src/main/java/org/springframework/web/util/WebUtils.java b/spring-web/src/main/java/org/springframework/web/util/WebUtils.java index 9841e53772..02ddfc3a3c 100644 --- a/spring-web/src/main/java/org/springframework/web/util/WebUtils.java +++ b/spring-web/src/main/java/org/springframework/web/util/WebUtils.java @@ -154,16 +154,15 @@ public abstract class WebUtils { String root = servletContext.getRealPath("/"); if (root == null) { 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 key = (param != null ? param : DEFAULT_WEB_APP_ROOT_KEY); String oldValue = System.getProperty(key); if (oldValue != null && !StringUtils.pathEquals(oldValue, root)) { - throw new IllegalStateException( - "Web app root system property already set to different value: '" + - key + "' = [" + oldValue + "] instead of [" + root + "] - " + - "Choose unique values for the 'webAppRootKey' context-param in your web.xml files!"); + throw new IllegalStateException("Web app root system property already set to different value: '" + + key + "' = [" + oldValue + "] instead of [" + root + "] - " + + "Choose unique values for the 'webAppRootKey' context-param in your web.xml files!"); } System.setProperty(key, root); servletContext.log("Set web app root system property: '" + key + "' = [" + root + "]");