From d2fed8bb0758afd77834cb50f34617f899a347c9 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 13 Jan 2016 09:02:19 +0000 Subject: [PATCH] Polish --- .../websocket/WebSocketAutoConfiguration.java | 5 +++-- ...TomcatEmbeddedServletContainerFactory.java | 20 +++++++++---------- ...ngsApplicationContextInitializerTests.java | 6 +++--- .../log4j2/Log4J2LoggingSystemTests.java | 5 ++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfiguration.java index 1c0a1da0e9..431e337610 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainer import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnJava; +import org.springframework.boot.autoconfigure.condition.ConditionalOnJava.JavaVersion; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; @@ -63,7 +64,7 @@ public class WebSocketAutoConfiguration { @Bean @ConditionalOnMissingBean(name = "websocketContainerCustomizer") - @ConditionalOnJava(ConditionalOnJava.JavaVersion.SEVEN) + @ConditionalOnJava(JavaVersion.SEVEN) public TomcatWebSocketContainerCustomizer websocketContainerCustomizer() { return new TomcatWebSocketContainerCustomizer(); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java index f516559be6..aac1c30ad1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -661,9 +661,9 @@ public class TomcatEmbeddedServletContainerFactory private static class TomcatErrorPage { - private static final String ERROR_PAGE_TOMCAT7 = "org.apache.catalina.deploy.ErrorPage"; + private static final String ERROR_PAGE_CLASS = "org.apache.tomcat.util.descriptor.web.ErrorPage"; - private static final String ERROR_PAGE_TOMCAT = "org.apache.tomcat.util.descriptor.web.ErrorPage"; + private static final String LEGACY_ERROR_PAGE_CLASS = "org.apache.catalina.deploy.ErrorPage"; private final String location; @@ -683,13 +683,13 @@ public class TomcatEmbeddedServletContainerFactory private Object createNativePage(ErrorPage errorPage) { Object nativePage = null; try { - if (ClassUtils.isPresent(ERROR_PAGE_TOMCAT, null)) { - nativePage = BeanUtils.instantiate(ClassUtils - .forName(ERROR_PAGE_TOMCAT, null)); + if (ClassUtils.isPresent(ERROR_PAGE_CLASS, null)) { + nativePage = BeanUtils + .instantiate(ClassUtils.forName(ERROR_PAGE_CLASS, null)); } - else if (ClassUtils.isPresent(ERROR_PAGE_TOMCAT7, null)) { - nativePage = BeanUtils.instantiate(ClassUtils - .forName(ERROR_PAGE_TOMCAT7, null)); + else if (ClassUtils.isPresent(LEGACY_ERROR_PAGE_CLASS, null)) { + nativePage = BeanUtils.instantiate( + ClassUtils.forName(LEGACY_ERROR_PAGE_CLASS, null)); } } catch (ClassNotFoundException ex) { @@ -704,7 +704,7 @@ public class TomcatEmbeddedServletContainerFactory public void addToContext(Context context) { Assert.state(this.nativePage != null, "Neither Tomcat 7 nor 8 detected so no native error page exists"); - if (ClassUtils.isPresent(ERROR_PAGE_TOMCAT, null)) { + if (ClassUtils.isPresent(ERROR_PAGE_CLASS, null)) { org.apache.tomcat.util.descriptor.web.ErrorPage errorPage = (org.apache.tomcat.util.descriptor.web.ErrorPage) this.nativePage; errorPage.setLocation(this.location); errorPage.setErrorCode(this.errorCode); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java index ee6fd2197f..c9d7559742 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -142,8 +142,8 @@ public class ConfigurationWarningsApplicationContextInitializerTests { } /** - * Testable ComponentScanPackageCheck that doesn't need to use the default - * or {@code org.springframework} package. + * Testable ComponentScanPackageCheck that doesn't need to use the default or + * {@code org.springframework} package. */ static class TestComponentScanPackageCheck extends ComponentScanPackageCheck { diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java index 5936f06c6c..ed6ca0366d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -194,8 +194,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { @Test public void springConfigLocations() throws Exception { String[] locations = getSpringConfigLocations(this.loggingSystem); - assertThat(locations, - equalTo(new String[] { "log4j2-spring.xml" })); + assertThat(locations, equalTo(new String[] { "log4j2-spring.xml" })); } @Test