Commit a3f3de22 authored by Phillip Webb's avatar Phillip Webb

Polish

parent 644ae2c2
......@@ -105,8 +105,7 @@ public class HealthIndicatorAutoConfiguration {
private final HealthIndicatorProperties properties;
public HealthIndicatorAutoConfiguration(
HealthIndicatorProperties properties) {
public HealthIndicatorAutoConfiguration(HealthIndicatorProperties properties) {
this.properties = properties;
}
......
......@@ -35,8 +35,8 @@ public class EhCacheStatisticsProvider implements CacheStatisticsProvider<EhCach
DefaultCacheStatistics statistics = new DefaultCacheStatistics();
StatisticsGateway ehCacheStatistics = cache.getNativeCache().getStatistics();
statistics.setSize(ehCacheStatistics.getSize());
Double hitRatio = cacheHitRatio(ehCacheStatistics);
if (!hitRatio.isNaN()) {
double hitRatio = cacheHitRatio(ehCacheStatistics);
if (!Double.isNaN(hitRatio)) {
// ratio is calculated 'racily' and can drift marginally above unity,
// so we cap it here
double sanitizedHitRatio = (hitRatio > 1 ? 1 : hitRatio);
......@@ -46,7 +46,7 @@ public class EhCacheStatisticsProvider implements CacheStatisticsProvider<EhCach
return statistics;
}
private static Double cacheHitRatio(StatisticsGateway stats) {
private double cacheHitRatio(StatisticsGateway stats) {
long hitCount = stats.cacheHitCount();
long cacheMissCount = stats.cacheMissCount();
return ((double) hitCount) / (hitCount + cacheMissCount);
......
......@@ -57,9 +57,11 @@ public class CouchbaseAutoConfiguration {
@Bean
@ConditionalOnBean(Validator.class)
public ValidatingCouchbaseEventListener validationEventListener(Validator validator) {
public ValidatingCouchbaseEventListener validationEventListener(
Validator validator) {
return new ValidatingCouchbaseEventListener(validator);
}
}
@Configuration
......
......@@ -74,8 +74,8 @@ public class ProjectInfoAutoConfiguration {
protected void bindPropertiesTo(Object target, Resource location, String prefix)
throws BindException, IOException {
PropertiesConfigurationFactory<Object> factory =
new PropertiesConfigurationFactory<Object>(target);
PropertiesConfigurationFactory<Object> factory = new PropertiesConfigurationFactory<Object>(
target);
factory.setConversionService(this.conversionService);
factory.setTargetName(prefix);
Properties gitInfoProperties = PropertiesLoaderUtils.loadProperties(location);
......@@ -89,7 +89,6 @@ public class ProjectInfoAutoConfiguration {
return conversionService;
}
static class GitResourceAvailableCondition extends SpringBootCondition {
private final ResourceLoader defaultResourceLoader = new DefaultResourceLoader();
......@@ -125,7 +124,8 @@ public class ProjectInfoAutoConfiguration {
if (epoch != null) {
return new Date(epoch);
}
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX", Locale.US);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX",
Locale.US);
try {
return format.parse(s);
}
......@@ -145,10 +145,11 @@ public class ProjectInfoAutoConfiguration {
try {
return Long.parseLong(s) * 1000;
}
catch (NumberFormatException e) {
catch (NumberFormatException ex) {
return null;
}
}
}
}
......@@ -64,7 +64,8 @@ public class CouchbaseRepositoriesAutoConfigurationTests {
@Test
public void disableRepository() {
load(DefaultConfiguration.class, "spring.data.couchbase.repositories.enabled=false");
load(DefaultConfiguration.class,
"spring.data.couchbase.repositories.enabled=false");
assertThat(this.context.getBeansOfType(CityRepository.class)).hasSize(0);
}
......@@ -87,14 +88,12 @@ public class CouchbaseRepositoriesAutoConfigurationTests {
this.context = context;
}
@Configuration
@TestAutoConfigurationPackage(City.class)
static class CouchbaseNotAvailableConfiguration {
}
@Configuration
@TestAutoConfigurationPackage(City.class)
@Import(CouchbaseTestConfiguration.class)
......
......@@ -86,7 +86,6 @@ public class ProjectInfoAutoConfigurationTests {
assertThat(gitInfo).isSameAs(this.context.getBean("customGitInfo"));
}
private void load(String... environment) {
load(null, environment);
}
......
......@@ -438,6 +438,7 @@ in the '`Spring Boot features`' section, or the
code.
[[howto-user-a-random-unassigned-http-port]]
=== Use a random unassigned HTTP port
To scan for a free port (using OS natives to prevent clashes) use `server.port=0`.
......@@ -507,6 +508,8 @@ the two to configure programmatically. See the
{github-code}/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors[`spring-boot-sample-tomcat-multi-connectors`]
sample project for an example.
[[howto-configure-accesslogs]]
=== Configure Access Logging
Access logs can be configured for Tomcat and Undertow via their respective namespaces.
......@@ -538,6 +541,7 @@ Logs are stored in a `logs` directory relative to the working directory of the
application. This can be customized via `server.undertow.accesslog.directory`.
[[howto-use-behind-a-proxy-server]]
[[howto-use-tomcat-behind-a-proxy-server]]
=== Use behind a front-end proxy server
......
......@@ -344,7 +344,6 @@ public class TomcatEmbeddedServletContainerFactoryTests
public void startupFailureDoesNotResultInUnstoppedThreadsBeingReported()
throws IOException {
super.portClashOfPrimaryConnectorResultsInPortInUseException();
String string = this.outputCapture.toString();
assertThat(string)
.doesNotContain("appears to have started a thread named [main]");
......
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