Commit 8d92236e authored by Phillip Webb's avatar Phillip Webb

Polish

parent 3ff878a9
......@@ -213,6 +213,7 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator implement
return super.matchesProduct(product)
|| product.toLowerCase().startsWith("firebird");
}
};
private final String product;
......
......@@ -23,7 +23,8 @@ import org.springframework.context.annotation.Configuration;
/**
* {@link EnableAutoConfiguration Auto-configuration} for {@link ConfigurationProperties}
* beans. Automatically binds and validates any bean annotated with {@code @ConfigurationProperties}.
* beans. Automatically binds and validates any bean annotated with
* {@code @ConfigurationProperties}.
*
* @author Stephane Nicoll
* @since 1.3.0
......
......@@ -55,9 +55,9 @@ public class H2ConsoleAutoConfiguration {
@Bean
public ServletRegistrationBean h2Console() {
return new ServletRegistrationBean(new WebServlet(), this.properties.getPath()
.endsWith("/") ? this.properties.getPath() + "*"
: this.properties.getPath() + "/*");
String path = this.properties.getPath();
String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*");
return new ServletRegistrationBean(new WebServlet(), urlMapping);
}
@Configuration
......@@ -83,9 +83,9 @@ public class H2ConsoleAutoConfiguration {
@Override
public void configure(HttpSecurity http) throws Exception {
HttpSecurity h2Console = http.antMatcher(this.console.getPath().endsWith(
"/") ? this.console.getPath() + "**" : this.console.getPath()
+ "/**");
String path = this.console.getPath();
String antPattern = (path.endsWith("/") ? path + "**" : path + "/**");
HttpSecurity h2Console = http.antMatcher(antPattern);
h2Console.csrf().disable();
h2Console.httpBasic();
h2Console.headers().frameOptions().sameOrigin();
......
......@@ -777,7 +777,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
}
public boolean isEnabled() {
return enabled;
return this.enabled;
}
public void setEnabled(boolean enabled) {
......@@ -785,7 +785,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
}
public String getPattern() {
return pattern;
return this.pattern;
}
public void setPattern(String pattern) {
......@@ -793,7 +793,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
}
public String getDirectory() {
return directory;
return this.directory;
}
public void setDirectory(String directory) {
......@@ -801,7 +801,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
}
public String getPrefix() {
return prefix;
return this.prefix;
}
public void setPrefix(String prefix) {
......@@ -809,7 +809,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
}
public String getSuffix() {
return suffix;
return this.suffix;
}
public void setSuffix(String suffix) {
......@@ -888,11 +888,8 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
this.directBuffers = directBuffers;
}
/**
* Access log configuration.
*/
public Accesslog getAccesslog() {
return accesslog;
return this.accesslog;
}
/**
......@@ -969,7 +966,6 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
factory.setAccessLogEnabled(this.accesslog.enabled);
}
public static class Accesslog {
/**
......@@ -988,7 +984,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
private File dir = new File("logs");
public boolean isEnabled() {
return enabled;
return this.enabled;
}
public void setEnabled(boolean enabled) {
......@@ -996,7 +992,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
}
public String getPattern() {
return pattern;
return this.pattern;
}
public void setPattern(String pattern) {
......@@ -1004,7 +1000,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
}
public File getDir() {
return dir;
return this.dir;
}
public void setDir(File dir) {
......
......@@ -88,6 +88,7 @@ public class H2ConsoleAutoConfigurationIntegrationTests {
public void mockConsole() {
}
}
}
......@@ -109,4 +109,5 @@ public class H2ConsoleAutoConfigurationTests {
assertThat(this.context.getBean(ServletRegistrationBean.class).getUrlMappings(),
hasItems("/custom/*"));
}
}
......@@ -89,9 +89,8 @@ public class ColorConverter extends LogEventPatternConverter {
*/
public static ColorConverter newInstance(Configuration config, String[] options) {
if (options.length < 1) {
LOGGER.error(
"Incorrect number of options on style. Expected at least 1, received {}",
options.length);
LOGGER.error("Incorrect number of options on style. "
+ "Expected at least 1, received {}", options.length);
return null;
}
if (options[0] == null) {
......@@ -100,8 +99,7 @@ public class ColorConverter extends LogEventPatternConverter {
}
PatternParser parser = PatternLayout.createPatternParser(config);
List<PatternFormatter> formatters = parser.parse(options[0]);
AnsiElement element = options.length == 1 ? null : ELEMENTS.get(options[1]);
AnsiElement element = (options.length == 1 ? null : ELEMENTS.get(options[1]));
return new ColorConverter(formatters, element);
}
......
......@@ -200,8 +200,8 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
this.loggingSystem.beforeInitialize();
this.logger.info("Hidden");
this.loggingSystem.initialize(null, null, null);
this.output
.expect(containsString("Wrapped by: java.lang.RuntimeException: Expected"));
this.output.expect(containsString("Wrapped by: "
+ "java.lang.RuntimeException: Expected"));
this.logger.warn("Expected exception", new RuntimeException("Expected",
new RuntimeException("Cause")));
}
......
......@@ -252,8 +252,8 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
this.loggingSystem.beforeInitialize();
this.logger.info("Hidden");
this.loggingSystem.initialize(this.initializationContext, null, null);
this.output
.expect(containsString("Wrapped by: java.lang.RuntimeException: Expected"));
this.output.expect(containsString("Wrapped by: "
+ "java.lang.RuntimeException: Expected"));
this.logger.warn("Expected exception", new RuntimeException("Expected",
new RuntimeException("Cause")));
}
......
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