Merge branch '2.0.x'

pull/13933/head
Phillip Webb 6 years ago
commit a6c9c92f2e

@ -24,7 +24,7 @@
</property>
</activation>
<properties>
<spring-javaformat.version>0.0.3</spring-javaformat.version>
<spring-javaformat.version>0.0.6</spring-javaformat.version>
</properties>
<build>
<plugins>
@ -36,7 +36,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.8</version>
<version>8.11</version>
</dependency>
<dependency>
<groupId>io.spring.javaformat</groupId>

@ -72,7 +72,7 @@ public class CloudFoundryWebEndpointDiscoverer extends WebEndpointDiscoverer {
AnnotationAttributes attributes = AnnotatedElementUtils
.getMergedAnnotationAttributes(extensionBean.getClass(),
EndpointWebExtension.class);
Class<?> endpoint = (attributes != null ? attributes.getClass("endpoint") : null);
Class<?> endpoint = (attributes != null) ? attributes.getClass("endpoint") : null;
return (endpoint != null && HealthEndpoint.class.isAssignableFrom(endpoint));
}

@ -126,8 +126,8 @@ public class ReactiveCloudFoundryActuatorAutoConfiguration {
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
boolean skipSslValidation = environment.getProperty(
"management.cloudfoundry.skip-ssl-validation", Boolean.class, false);
return (cloudControllerUrl != null ? new ReactiveCloudFoundrySecurityService(
webClientBuilder, cloudControllerUrl, skipSslValidation) : null);
return (cloudControllerUrl != null) ? new ReactiveCloudFoundrySecurityService(
webClientBuilder, cloudControllerUrl, skipSslValidation) : null;
}
private CorsConfiguration getCorsConfiguration() {

@ -130,8 +130,8 @@ public class CloudFoundryActuatorAutoConfiguration {
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
boolean skipSslValidation = environment.getProperty(
"management.cloudfoundry.skip-ssl-validation", Boolean.class, false);
return (cloudControllerUrl != null ? new CloudFoundrySecurityService(
restTemplateBuilder, cloudControllerUrl, skipSslValidation) : null);
return (cloudControllerUrl != null) ? new CloudFoundrySecurityService(
restTemplateBuilder, cloudControllerUrl, skipSslValidation) : null;
}
private CorsConfiguration getCorsConfiguration() {

@ -125,8 +125,8 @@ public class ConditionsReportEndpoint {
this.unconditionalClasses = report.getUnconditionalClasses();
report.getConditionAndOutcomesBySource().forEach(
(source, conditionAndOutcomes) -> add(source, conditionAndOutcomes));
this.parentId = (context.getParent() != null ? context.getParent().getId()
: null);
this.parentId = (context.getParent() != null) ? context.getParent().getId()
: null;
}
private void add(String source, ConditionAndOutcomes conditionAndOutcomes) {

@ -82,7 +82,7 @@ public class ElasticsearchHealthIndicatorAutoConfiguration {
protected ElasticsearchHealthIndicator createHealthIndicator(Client client) {
Duration responseTimeout = this.properties.getResponseTimeout();
return new ElasticsearchHealthIndicator(client,
responseTimeout != null ? responseTimeout.toMillis() : 100,
(responseTimeout != null) ? responseTimeout.toMillis() : 100,
this.properties.getIndices());
}

@ -36,7 +36,7 @@ import org.springframework.util.Assert;
* {@link EndpointFilter} that will filter endpoints based on {@code include} and
* {@code exclude} properties.
*
* @param <E> The endpoint type
* @param <E> the endpoint type
* @author Phillip Webb
* @since 2.0.0
*/

@ -112,7 +112,7 @@ public class DataSourceHealthIndicatorAutoConfiguration extends
private String getValidationQuery(DataSource source) {
DataSourcePoolMetadata poolMetadata = this.poolMetadataProvider
.getDataSourcePoolMetadata(source);
return (poolMetadata != null ? poolMetadata.getValidationQuery() : null);
return (poolMetadata != null) ? poolMetadata.getValidationQuery() : null;
}
}

@ -51,9 +51,9 @@ class MeterRegistryConfigurer {
Collection<MeterFilter> filters,
Collection<MeterRegistryCustomizer<?>> customizers,
boolean addToGlobalRegistry) {
this.binders = (binders != null ? binders : Collections.emptyList());
this.filters = (filters != null ? filters : Collections.emptyList());
this.customizers = (customizers != null ? customizers : Collections.emptyList());
this.binders = (binders != null) ? binders : Collections.emptyList();
this.filters = (filters != null) ? filters : Collections.emptyList();
this.customizers = (customizers != null) ? customizers : Collections.emptyList();
this.addToGlobalRegistry = addToGlobalRegistry;
}

@ -27,7 +27,7 @@ import io.micrometer.core.instrument.MeterRegistry;
* the registry.
*
* @author Jon Schneider
* @param <T> The registry type to customize
* @param <T> the registry type to customize
* @since 2.0.0
*/
@FunctionalInterface

@ -90,10 +90,10 @@ public class PropertiesMeterFilter implements MeterFilter {
}
private long[] convertSla(Meter.Type meterType, ServiceLevelAgreementBoundary[] sla) {
long[] converted = Arrays.stream(sla != null ? sla : EMPTY_SLA)
long[] converted = Arrays.stream((sla != null) ? sla : EMPTY_SLA)
.map((candidate) -> candidate.getValue(meterType))
.filter(Objects::nonNull).mapToLong(Long::longValue).toArray();
return (converted.length != 0 ? converted : null);
return (converted.length != 0) ? converted : null;
}
private <T> T lookup(Map<String, T> values, Id id, T defaultValue) {
@ -107,7 +107,7 @@ public class PropertiesMeterFilter implements MeterFilter {
return result;
}
int lastDot = name.lastIndexOf('.');
name = (lastDot != -1 ? name.substring(0, lastDot) : "");
name = (lastDot != -1) ? name.substring(0, lastDot) : "";
}
return values.getOrDefault("all", defaultValue);
}

@ -24,7 +24,7 @@ import org.springframework.util.Assert;
/**
* Base class for properties to config adapters.
*
* @param <T> The properties type
* @param <T> the properties type
* @author Phillip Webb
* @author Nikolay Rybak
* @since 2.0.0
@ -51,7 +51,7 @@ public class PropertiesConfigAdapter<T> {
*/
protected final <V> V get(Function<T, V> getter, Supplier<V> fallback) {
V value = getter.apply(this.properties);
return (value != null ? value : fallback.get());
return (value != null) ? value : fallback.get();
}
}

@ -23,7 +23,7 @@ import io.micrometer.core.instrument.step.StepRegistryConfig;
/**
* Base class for {@link StepRegistryProperties} to {@link StepRegistryConfig} adapters.
*
* @param <T> The properties type
* @param <T> the properties type
* @author Jon Schneider
* @author Phillip Webb
* @since 2.0.0

@ -60,7 +60,7 @@ public class WavefrontPropertiesConfigAdapter
}
private String getUriAsString(WavefrontProperties properties) {
return (properties.getUri() != null ? properties.getUri().toString() : null);
return (properties.getUri() != null) ? properties.getUri().toString() : null;
}
}

@ -47,7 +47,8 @@ public class TomcatMetricsAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public TomcatMetrics tomcatMetrics() {
return new TomcatMetrics(this.context != null ? this.context.getManager() : null,
return new TomcatMetrics(
(this.context != null) ? this.context.getManager() : null,
Collections.emptyList());
}

@ -125,17 +125,17 @@ class ManagementContextConfigurationImportSelector
Map<String, Object> annotationAttributes = annotationMetadata
.getAnnotationAttributes(
ManagementContextConfiguration.class.getName());
return (annotationAttributes != null
return (annotationAttributes != null)
? (ManagementContextType) annotationAttributes.get("value")
: ManagementContextType.ANY);
: ManagementContextType.ANY;
}
private int readOrder(AnnotationMetadata annotationMetadata) {
Map<String, Object> attributes = annotationMetadata
.getAnnotationAttributes(Order.class.getName());
Integer order = (attributes != null ? (Integer) attributes.get("value")
: null);
return (order != null ? order : Ordered.LOWEST_PRECEDENCE);
Integer order = (attributes != null) ? (Integer) attributes.get("value")
: null;
return (order != null) ? order : Ordered.LOWEST_PRECEDENCE;
}
public String getClassName() {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -47,9 +47,9 @@ public enum ManagementPortType {
if (managementPort != null && managementPort < 0) {
return DISABLED;
}
return ((managementPort == null)
return ((managementPort == null
|| (serverPort == null && managementPort.equals(8080))
|| (managementPort != 0 && managementPort.equals(serverPort)) ? SAME
|| (managementPort != 0 && managementPort.equals(serverPort))) ? SAME
: DIFFERENT);
}

@ -52,17 +52,17 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
}
public ServletContext getServletContext() {
return (getWebServer() != null ? getWebServer().getServletContext() : null);
return (getWebServer() != null) ? getWebServer().getServletContext() : null;
}
public RegisteredServlet getRegisteredServlet(int index) {
return (getWebServer() != null ? getWebServer().getRegisteredServlet(index)
: null);
return (getWebServer() != null) ? getWebServer().getRegisteredServlet(index)
: null;
}
public RegisteredFilter getRegisteredFilter(int index) {
return (getWebServer() != null ? getWebServer().getRegisteredFilters(index)
: null);
return (getWebServer() != null) ? getWebServer().getRegisteredFilters(index)
: null;
}
public static class MockServletWebServer

@ -55,9 +55,9 @@ public class AuditEvent implements Serializable {
/**
* Create a new audit event for the current time.
* @param principal The user principal responsible
* @param principal the user principal responsible
* @param type the event type
* @param data The event data
* @param data the event data
*/
public AuditEvent(String principal, String type, Map<String, Object> data) {
this(Instant.now(), principal, type, data);
@ -66,9 +66,9 @@ public class AuditEvent implements Serializable {
/**
* Create a new audit event for the current time from data provided as name-value
* pairs.
* @param principal The user principal responsible
* @param principal the user principal responsible
* @param type the event type
* @param data The event data in the form 'key=value' or simply 'key'
* @param data the event data in the form 'key=value' or simply 'key'
*/
public AuditEvent(String principal, String type, String... data) {
this(Instant.now(), principal, type, convert(data));
@ -76,17 +76,17 @@ public class AuditEvent implements Serializable {
/**
* Create a new audit event.
* @param timestamp The date/time of the event
* @param principal The user principal responsible
* @param timestamp the date/time of the event
* @param principal the user principal responsible
* @param type the event type
* @param data The event data
* @param data the event data
*/
public AuditEvent(Instant timestamp, String principal, String type,
Map<String, Object> data) {
Assert.notNull(timestamp, "Timestamp must not be null");
Assert.notNull(type, "Type must not be null");
this.timestamp = timestamp;
this.principal = (principal != null ? principal : "");
this.principal = (principal != null) ? principal : "";
this.type = type;
this.data = Collections.unmodifiableMap(data);
}

@ -50,7 +50,7 @@ public class AuditEventsEndpoint {
}
private Instant getInstant(OffsetDateTime offsetDateTime) {
return (offsetDateTime != null ? offsetDateTime.toInstant() : null);
return (offsetDateTime != null) ? offsetDateTime.toInstant() : null;
}
/**

@ -118,7 +118,7 @@ public class BeansEndpoint {
}
ConfigurableApplicationContext parent = getConfigurableParent(context);
return new ContextBeans(describeBeans(context.getBeanFactory()),
parent != null ? parent.getId() : null);
(parent != null) ? parent.getId() : null);
}
private static Map<String, BeanDescriptor> describeBeans(

@ -118,7 +118,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
prefix, sanitize(prefix, safeSerialize(mapper, bean, prefix))));
});
return new ContextConfigurationProperties(beanDescriptors,
context.getParent() != null ? context.getParent().getId() : null);
(context.getParent() != null) ? context.getParent().getId() : null);
}
private ConfigurationBeanFactoryMetadata getBeanFactoryMetadata(

@ -55,7 +55,7 @@ public class ElasticsearchHealthIndicator extends AbstractHealthIndicator {
public ElasticsearchHealthIndicator(Client client, long responseTimeout,
List<String> indices) {
this(client, responseTimeout,
(indices != null ? StringUtils.toStringArray(indices) : null));
(indices != null) ? StringUtils.toStringArray(indices) : null);
}
/**

@ -26,7 +26,7 @@ import org.springframework.util.Assert;
/**
* Abstract base class for {@link ExposableEndpoint} implementations.
*
* @param <O> The operation type.
* @param <O> the operation type.
* @author Phillip Webb
* @since 2.0.0
*/

@ -28,7 +28,7 @@ import org.springframework.util.Assert;
* Abstract base class for {@link ExposableEndpoint endpoints} discovered by a
* {@link EndpointDiscoverer}.
*
* @param <O> The operation type
* @param <O> the operation type
* @author Phillip Webb
* @since 2.0.0
*/

@ -22,7 +22,7 @@ import org.springframework.boot.actuate.endpoint.Operation;
/**
* An {@link ExposableEndpoint endpoint} discovered by an {@link EndpointDiscoverer}.
*
* @param <O> The operation type
* @param <O> the operation type
* @author Phillip Webb
* @since 2.0.0
*/

@ -40,7 +40,7 @@ import org.springframework.core.annotation.AnnotationAttributes;
* Factory to create an {@link Operation} for annotated methods on an
* {@link Endpoint @Endpoint} or {@link EndpointExtension @EndpointExtension}.
*
* @param <O> The operation type
* @param <O> the operation type
* @author Andy Wilkinson
* @author Stephane Nicoll
* @author Phillip Webb

@ -54,8 +54,8 @@ import org.springframework.util.StringUtils;
* {@link Endpoint @Endpoint} beans and {@link EndpointExtension @EndpointExtension} beans
* in an application context.
*
* @param <E> The endpoint type
* @param <O> The operation type
* @param <E> the endpoint type
* @param <O> the operation type
* @author Andy Wilkinson
* @author Stephane Nicoll
* @author Phillip Webb
@ -382,11 +382,6 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
this.description = description;
}
@Override
public int hashCode() {
return this.key.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -398,6 +393,11 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
return this.key.equals(((OperationKey) obj).key);
}
@Override
public int hashCode() {
return this.key.hashCode();
}
@Override
public String toString() {
return this.description.get();

@ -39,7 +39,7 @@ public class JacksonJmxOperationResponseMapper implements JmxOperationResponseMa
private final JavaType mapType;
public JacksonJmxOperationResponseMapper(ObjectMapper objectMapper) {
this.objectMapper = (objectMapper != null ? objectMapper : new ObjectMapper());
this.objectMapper = (objectMapper != null) ? objectMapper : new ObjectMapper();
this.listType = this.objectMapper.getTypeFactory()
.constructParametricType(List.class, Object.class);
this.mapType = this.objectMapper.getTypeFactory()

@ -46,7 +46,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
*/
public PathMappedEndpoints(String basePath, EndpointsSupplier<?> supplier) {
Assert.notNull(supplier, "Supplier must not be null");
this.basePath = (basePath != null ? basePath : "");
this.basePath = (basePath != null) ? basePath : "";
this.endpoints = getEndpoints(Collections.singleton(supplier));
}
@ -58,7 +58,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
public PathMappedEndpoints(String basePath,
Collection<EndpointsSupplier<?>> suppliers) {
Assert.notNull(suppliers, "Suppliers must not be null");
this.basePath = (basePath != null ? basePath : "");
this.basePath = (basePath != null) ? basePath : "";
this.endpoints = getEndpoints(suppliers);
}
@ -91,7 +91,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
*/
public String getRootPath(String endpointId) {
PathMappedEndpoint endpoint = getEndpoint(endpointId);
return (endpoint != null ? endpoint.getRootPath() : null);
return (endpoint != null) ? endpoint.getRootPath() : null;
}
/**
@ -144,7 +144,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
}
private String getPath(PathMappedEndpoint endpoint) {
return (endpoint != null ? this.basePath + "/" + endpoint.getRootPath() : null);
return (endpoint != null) ? this.basePath + "/" + endpoint.getRootPath() : null;
}
private <T> List<T> asList(Stream<T> stream) {

@ -47,7 +47,7 @@ public class ServletEndpointRegistrar implements ServletContextInitializer {
public ServletEndpointRegistrar(String basePath,
Collection<ExposableServletEndpoint> servletEndpoints) {
Assert.notNull(servletEndpoints, "ServletEndpoints must not be null");
this.basePath = (basePath != null ? basePath : "");
this.basePath = (basePath != null) ? basePath : "";
this.servletEndpoints = servletEndpoints;
}

@ -89,18 +89,20 @@ public final class WebOperationRequestPredicate {
}
@Override
public String toString() {
StringBuilder result = new StringBuilder(
this.httpMethod + " to path '" + this.path + "'");
if (!CollectionUtils.isEmpty(this.consumes)) {
result.append(" consumes: "
+ StringUtils.collectionToCommaDelimitedString(this.consumes));
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!CollectionUtils.isEmpty(this.produces)) {
result.append(" produces: "
+ StringUtils.collectionToCommaDelimitedString(this.produces));
if (obj == null || getClass() != obj.getClass()) {
return false;
}
return result.toString();
WebOperationRequestPredicate other = (WebOperationRequestPredicate) obj;
boolean result = true;
result = result && this.consumes.equals(other.consumes);
result = result && this.httpMethod == other.httpMethod;
result = result && this.canonicalPath.equals(other.canonicalPath);
result = result && this.produces.equals(other.produces);
return result;
}
@Override
@ -115,20 +117,18 @@ public final class WebOperationRequestPredicate {
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
public String toString() {
StringBuilder result = new StringBuilder(
this.httpMethod + " to path '" + this.path + "'");
if (!CollectionUtils.isEmpty(this.consumes)) {
result.append(" consumes: "
+ StringUtils.collectionToCommaDelimitedString(this.consumes));
}
if (obj == null || getClass() != obj.getClass()) {
return false;
if (!CollectionUtils.isEmpty(this.produces)) {
result.append(" produces: "
+ StringUtils.collectionToCommaDelimitedString(this.produces));
}
WebOperationRequestPredicate other = (WebOperationRequestPredicate) obj;
boolean result = true;
result = result && this.consumes.equals(other.consumes);
result = result && this.httpMethod == other.httpMethod;
result = result && this.canonicalPath.equals(other.canonicalPath);
result = result && this.produces.equals(other.produces);
return result;
return result.toString();
}
}

@ -179,7 +179,7 @@ public class JerseyEndpointResourceFactory {
Map<String, Object> result = new HashMap<>();
multivaluedMap.forEach((name, values) -> {
if (!CollectionUtils.isEmpty(values)) {
result.put(name, values.size() != 1 ? values : values.get(0));
result.put(name, (values.size() != 1) ? values : values.get(0));
}
});
return result;

@ -310,7 +310,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
arguments.putAll(body);
}
exchange.getRequest().getQueryParams().forEach((name, values) -> arguments
.put(name, values.size() != 1 ? values : values.get(0)));
.put(name, (values.size() != 1) ? values : values.get(0)));
return arguments;
}
@ -324,7 +324,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
.onErrorMap(InvalidEndpointRequestException.class,
(ex) -> new ResponseStatusException(HttpStatus.BAD_REQUEST,
ex.getReason()))
.defaultIfEmpty(new ResponseEntity<>(httpMethod != HttpMethod.GET
.defaultIfEmpty(new ResponseEntity<>((httpMethod != HttpMethod.GET)
? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND));
}

@ -257,7 +257,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping
arguments.putAll(body);
}
request.getParameterMap().forEach((name, values) -> arguments.put(name,
values.length != 1 ? Arrays.asList(values) : values[0]));
(values.length != 1) ? Arrays.asList(values) : values[0]));
return arguments;
}
@ -269,7 +269,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping
private Object handleResult(Object result, HttpMethod httpMethod) {
if (result == null) {
return new ResponseEntity<>(httpMethod != HttpMethod.GET
return new ResponseEntity<>((httpMethod != HttpMethod.GET)
? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND);
}
if (!(result instanceof WebEndpointResponse)) {

@ -160,7 +160,7 @@ public class EnvironmentEndpoint {
private String getOrigin(OriginLookup<Object> lookup, String name) {
Origin origin = lookup.getOrigin(name);
return (origin != null ? origin.toString() : null);
return (origin != null) ? origin.toString() : null;
}
private PlaceholdersResolver getResolver() {

@ -59,7 +59,7 @@ public class FlywayEndpoint {
.put(name, new FlywayDescriptor(flyway.info().all())));
ApplicationContext parent = target.getParent();
contextFlywayBeans.put(target.getId(), new ContextFlywayBeans(flywayBeans,
parent != null ? parent.getId() : null));
(parent != null) ? parent.getId() : null));
target = parent;
}
return new ApplicationFlywayBeans(contextFlywayBeans);
@ -170,7 +170,7 @@ public class FlywayEndpoint {
}
private String nullSafeToString(Object obj) {
return (obj != null ? obj.toString() : null);
return (obj != null) ? obj.toString() : null;
}
public MigrationType getType() {

@ -82,8 +82,8 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
ReactiveHealthIndicatorRegistry registry) {
this.registry = registry;
this.healthAggregator = healthAggregator;
this.timeoutCompose = (mono) -> (this.timeout != null ? mono.timeout(
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono);
this.timeoutCompose = (mono) -> (this.timeout != null) ? mono.timeout(
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono;
}
/**
@ -115,8 +115,8 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
public CompositeReactiveHealthIndicator timeoutStrategy(long timeout,
Health timeoutHealth) {
this.timeout = timeout;
this.timeoutHealth = (timeoutHealth != null ? timeoutHealth
: Health.unknown().build());
this.timeoutHealth = (timeoutHealth != null) ? timeoutHealth
: Health.unknown().build();
return this;
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -98,7 +98,7 @@ public class OrderedHealthAggregator extends AbstractHealthAggregator {
public int compare(Status s1, Status s2) {
int i1 = this.statusOrder.indexOf(s1.getCode());
int i2 = this.statusOrder.indexOf(s2.getCode());
return (i1 < i2 ? -1 : (i1 != i2 ? 1 : s1.getCode().compareTo(s2.getCode())));
return (i1 < i2) ? -1 : (i1 != i2) ? 1 : s1.getCode().compareTo(s2.getCode());
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -102,16 +102,6 @@ public final class Status {
return this.description;
}
@Override
public String toString() {
return this.code;
}
@Override
public int hashCode() {
return this.code.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -123,4 +113,14 @@ public final class Status {
return false;
}
@Override
public int hashCode() {
return this.code.hashCode();
}
@Override
public String toString() {
return this.code;
}
}

@ -86,7 +86,7 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator
super("DataSource health check failed");
this.dataSource = dataSource;
this.query = query;
this.jdbcTemplate = (dataSource != null ? new JdbcTemplate(dataSource) : null);
this.jdbcTemplate = (dataSource != null) ? new JdbcTemplate(dataSource) : null;
}
@Override

@ -69,7 +69,7 @@ public class LiquibaseEndpoint {
createReport(liquibase, service, factory)));
ApplicationContext parent = target.getParent();
contextBeans.put(target.getId(), new ContextLiquibaseBeans(liquibaseBeans,
parent != null ? parent.getId() : null));
(parent != null) ? parent.getId() : null));
target = parent;
}
return new ApplicationLiquibaseBeans(contextBeans);
@ -210,7 +210,7 @@ public class LiquibaseEndpoint {
this.execType = ranChangeSet.getExecType();
this.id = ranChangeSet.getId();
this.labels = ranChangeSet.getLabels().getLabels();
this.checksum = (ranChangeSet.getLastCheckSum() != null
this.checksum = ((ranChangeSet.getLastCheckSum() != null)
? ranChangeSet.getLastCheckSum().toString() : null);
this.orderExecuted = ranChangeSet.getOrderExecuted();
this.tag = ranChangeSet.getTag();

@ -73,7 +73,7 @@ public class LoggersEndpoint {
Assert.notNull(name, "Name must not be null");
LoggerConfiguration configuration = this.loggingSystem
.getLoggerConfiguration(name);
return (configuration != null ? new LoggerLevels(configuration) : null);
return (configuration != null) ? new LoggerLevels(configuration) : null;
}
@WriteOperation
@ -112,7 +112,7 @@ public class LoggersEndpoint {
}
private String getName(LogLevel level) {
return (level != null ? level.name() : null);
return (level != null) ? level.name() : null;
}
public String getConfiguredLevel() {

@ -78,7 +78,7 @@ public class HeapDumpWebEndpoint {
if (this.lock.tryLock(this.timeout, TimeUnit.MILLISECONDS)) {
try {
return new WebEndpointResponse<>(
dumpHeap(live != null ? live : true));
dumpHeap((live != null) ? live : true));
}
finally {
this.lock.unlock();

@ -47,7 +47,7 @@ public class RabbitMetrics implements MeterBinder {
public RabbitMetrics(ConnectionFactory connectionFactory, Iterable<Tag> tags) {
Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
this.connectionFactory = connectionFactory;
this.tags = (tags != null ? tags : Collections.emptyList());
this.tags = (tags != null) ? tags : Collections.emptyList();
}
@Override

@ -24,7 +24,7 @@ import org.springframework.cache.Cache;
/**
* Provide a {@link MeterBinder} based on a {@link Cache}.
*
* @param <C> The cache type
* @param <C> the cache type
* @author Stephane Nicoll
* @since 2.0.0
*/

@ -73,7 +73,7 @@ public final class RestTemplateExchangeTags {
}
private static String ensureLeadingSlash(String url) {
return (url == null || url.startsWith("/") ? url : "/" + url);
return (url == null || url.startsWith("/")) ? url : "/" + url;
}
/**

@ -60,7 +60,7 @@ public final class WebMvcTags {
* @return the method tag whose value is a capitalized method (e.g. GET).
*/
public static Tag method(HttpServletRequest request) {
return (request != null ? Tag.of("method", request.getMethod()) : METHOD_UNKNOWN);
return (request != null) ? Tag.of("method", request.getMethod()) : METHOD_UNKNOWN;
}
/**
@ -69,9 +69,9 @@ public final class WebMvcTags {
* @return the status tag derived from the status of the response
*/
public static Tag status(HttpServletResponse response) {
return (response != null
return (response != null)
? Tag.of("status", Integer.toString(response.getStatus()))
: STATUS_UNKNOWN);
: STATUS_UNKNOWN;
}
/**

@ -48,7 +48,7 @@ public class SolrHealthIndicator extends AbstractHealthIndicator {
request.setAction(CoreAdminParams.CoreAdminAction.STATUS);
CoreAdminResponse response = request.process(this.solrClient);
int statusCode = response.getStatus();
Status status = (statusCode != 0 ? Status.DOWN : Status.UP);
Status status = (statusCode != 0) ? Status.DOWN : Status.UP;
builder.status(status).withDetail("status", statusCode);
}

@ -59,7 +59,7 @@ public class MappingsEndpoint {
this.descriptionProviders
.forEach((provider) -> mappings.put(provider.getMappingName(),
provider.describeMappings(applicationContext)));
return new ContextMappings(mappings, applicationContext.getParent() != null
return new ContextMappings(mappings, (applicationContext.getParent() != null)
? applicationContext.getId() : null);
}

@ -64,7 +64,7 @@ final class DispatcherServletHandlerMappings {
initializeDispatcherServletIfPossible();
handlerMappings = this.dispatcherServlet.getHandlerMappings();
}
return (handlerMappings != null ? handlerMappings : Collections.emptyList());
return (handlerMappings != null) ? handlerMappings : Collections.emptyList();
}
private void initializeDispatcherServletIfPossible() {

@ -98,8 +98,8 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
HttpTrace trace = this.tracer.receivedRequest(request);
return chain.filter(exchange).doAfterSuccessOrError((aVoid, ex) -> {
TraceableServerHttpResponse response = new TraceableServerHttpResponse(
(ex != null ? new CustomStatusResponseDecorator(ex,
exchange.getResponse()) : exchange.getResponse()));
(ex != null) ? new CustomStatusResponseDecorator(ex,
exchange.getResponse()) : exchange.getResponse());
this.tracer.sendingResponse(trace, response, () -> principal,
() -> getStartedSessionId(session));
this.repository.add(trace);
@ -107,7 +107,7 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
}
private String getStartedSessionId(WebSession session) {
return (session != null && session.isStarted() ? session.getId() : null);
return (session != null && session.isStarted()) ? session.getId() : null;
}
private static final class CustomStatusResponseDecorator
@ -117,9 +117,9 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
private CustomStatusResponseDecorator(Throwable ex, ServerHttpResponse delegate) {
super(delegate);
this.status = (ex instanceof ResponseStatusException
this.status = (ex instanceof ResponseStatusException)
? ((ResponseStatusException) ex).getStatus()
: HttpStatus.INTERNAL_SERVER_ERROR);
: HttpStatus.INTERNAL_SERVER_ERROR;
}
@Override

@ -45,8 +45,8 @@ class ServerWebExchangeTraceableRequest implements TraceableRequest {
this.method = request.getMethodValue();
this.headers = request.getHeaders();
this.uri = request.getURI();
this.remoteAddress = (request.getRemoteAddress() != null
? request.getRemoteAddress().getAddress().toString() : null);
this.remoteAddress = (request.getRemoteAddress() != null)
? request.getRemoteAddress().getAddress().toString() : null;
}
@Override

@ -38,8 +38,8 @@ class TraceableServerHttpResponse implements TraceableResponse {
@Override
public int getStatus() {
return (this.response.getStatusCode() != null
? this.response.getStatusCode().value() : 200);
return (this.response.getStatusCode() != null)
? this.response.getStatusCode().value() : 200;
}
@Override

@ -92,7 +92,7 @@ public class HttpTraceFilter extends OncePerRequestFilter implements Ordered {
}
finally {
TraceableHttpServletResponse traceableResponse = new TraceableHttpServletResponse(
status != response.getStatus()
(status != response.getStatus())
? new CustomStatusResponseWrapper(response, status)
: response);
this.tracer.sendingResponse(trace, traceableResponse,
@ -113,7 +113,7 @@ public class HttpTraceFilter extends OncePerRequestFilter implements Ordered {
private String getSessionId(HttpServletRequest request) {
HttpSession session = request.getSession(false);
return (session != null ? session.getId() : null);
return (session != null) ? session.getId() : null;
}
private static final class CustomStatusResponseWrapper

@ -255,7 +255,7 @@ public class ConfigurationPropertiesReportEndpointTests {
}
public boolean isMixedBoolean() {
return (this.mixedBoolean != null ? this.mixedBoolean : false);
return (this.mixedBoolean != null) ? this.mixedBoolean : false;
}
public void setMixedBoolean(Boolean mixedBoolean) {

@ -56,8 +56,8 @@ public class ReflectiveOperationInvokerTests {
this.operationMethod = new OperationMethod(
ReflectionUtils.findMethod(Example.class, "reverse", String.class),
OperationType.READ);
this.parameterValueMapper = (parameter,
value) -> (value != null ? value.toString() : null);
this.parameterValueMapper = (parameter, value) -> (value != null)
? value.toString() : null;
}
@Test

@ -190,9 +190,9 @@ public class JmxEndpointExporterTests {
@Override
public ObjectName getObjectName(ExposableJmxEndpoint endpoint)
throws MalformedObjectNameException {
return (endpoint != null
return (endpoint != null)
? new ObjectName("boot:type=Endpoint,name=" + endpoint.getId())
: null);
: null;
}
}

@ -68,8 +68,8 @@ public class TestJmxOperation implements JmxOperation {
@Override
public Object invoke(InvocationContext context) {
return (this.invoke != null ? this.invoke.apply(context.getArguments())
: "result");
return (this.invoke != null) ? this.invoke.apply(context.getArguments())
: "result";
}
@Override

@ -835,7 +835,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
@ReadOperation
public String read(@Nullable Principal principal) {
return (principal != null ? principal.getName() : "None");
return (principal != null) ? principal.getName() : "None";
}
}
@ -856,7 +856,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
@ReadOperation
public String read(SecurityContext securityContext) {
Principal principal = securityContext.getPrincipal();
return (principal != null ? principal.getName() : "None");
return (principal != null) ? principal.getName() : "None";
}
}

@ -326,7 +326,7 @@ public class HttpExchangeTracerTests {
private String mixedCase(String input) {
StringBuilder output = new StringBuilder();
for (int i = 0; i < input.length(); i++) {
output.append(i % 2 != 0 ? Character.toUpperCase(input.charAt(i))
output.append((i % 2 != 0) ? Character.toUpperCase(input.charAt(i))
: Character.toLowerCase(input.charAt(i)));
}
return output.toString();

@ -248,7 +248,7 @@ public class AutoConfigurationImportSelector
}
String[] excludes = getEnvironment()
.getProperty(PROPERTY_NAME_AUTOCONFIGURE_EXCLUDE, String[].class);
return (excludes != null ? Arrays.asList(excludes) : Collections.emptyList());
return (excludes != null) ? Arrays.asList(excludes) : Collections.emptyList();
}
private List<String> filter(List<String> configurations,
@ -296,7 +296,7 @@ public class AutoConfigurationImportSelector
protected final List<String> asList(AnnotationAttributes attributes, String name) {
String[] value = attributes.getStringArray(name);
return Arrays.asList(value != null ? value : new String[0]);
return Arrays.asList((value != null) ? value : new String[0]);
}
private void fireAutoConfigurationImportEvents(List<String> configurations,

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -45,8 +45,8 @@ final class AutoConfigurationMetadataLoader {
static AutoConfigurationMetadata loadMetadata(ClassLoader classLoader, String path) {
try {
Enumeration<URL> urls = (classLoader != null ? classLoader.getResources(path)
: ClassLoader.getSystemResources(path));
Enumeration<URL> urls = (classLoader != null) ? classLoader.getResources(path)
: ClassLoader.getSystemResources(path);
Properties properties = new Properties();
while (urls.hasMoreElements()) {
properties.putAll(PropertiesLoaderUtils
@ -89,7 +89,7 @@ final class AutoConfigurationMetadataLoader {
@Override
public Integer getInteger(String className, String key, Integer defaultValue) {
String value = get(className, key);
return (value != null ? Integer.valueOf(value) : defaultValue);
return (value != null) ? Integer.valueOf(value) : defaultValue;
}
@Override
@ -101,8 +101,8 @@ final class AutoConfigurationMetadataLoader {
public Set<String> getSet(String className, String key,
Set<String> defaultValue) {
String value = get(className, key);
return (value != null ? StringUtils.commaDelimitedListToSet(value)
: defaultValue);
return (value != null) ? StringUtils.commaDelimitedListToSet(value)
: defaultValue;
}
@Override
@ -113,7 +113,7 @@ final class AutoConfigurationMetadataLoader {
@Override
public String get(String className, String key, String defaultValue) {
String value = this.properties.getProperty(className + "." + key);
return (value != null ? value : defaultValue);
return (value != null) ? value : defaultValue;
}
}

@ -147,9 +147,8 @@ public abstract class AutoConfigurationPackages {
this.packageName = ClassUtils.getPackageName(metadata.getClassName());
}
@Override
public int hashCode() {
return this.packageName.hashCode();
public String getPackageName() {
return this.packageName;
}
@Override
@ -160,8 +159,9 @@ public abstract class AutoConfigurationPackages {
return this.packageName.equals(((PackageImport) obj).packageName);
}
public String getPackageName() {
return this.packageName;
@Override
public int hashCode() {
return this.packageName.hashCode();
}
@Override

@ -213,8 +213,8 @@ class AutoConfigurationSorter {
}
Map<String, Object> attributes = getAnnotationMetadata()
.getAnnotationAttributes(AutoConfigureOrder.class.getName());
return (attributes != null ? (Integer) attributes.get("value")
: AutoConfigureOrder.DEFAULT_ORDER);
return (attributes != null) ? (Integer) attributes.get("value")
: AutoConfigureOrder.DEFAULT_ORDER;
}
private boolean wasProcessed() {

@ -109,8 +109,8 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec
for (String annotationName : ANNOTATION_NAMES) {
AnnotationAttributes merged = AnnotatedElementUtils
.getMergedAnnotationAttributes(source, annotationName);
Class<?>[] exclude = (merged != null ? merged.getClassArray("exclude")
: null);
Class<?>[] exclude = (merged != null) ? merged.getClassArray("exclude")
: null;
if (exclude != null) {
for (Class<?> excludeClass : exclude) {
exclusions.add(excludeClass.getName());

@ -26,6 +26,7 @@ import org.springframework.amqp.rabbit.retry.MessageRecoverer;
import org.springframework.amqp.rabbit.retry.RejectAndDontRequeueRecoverer;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.boot.autoconfigure.amqp.RabbitProperties.ListenerRetry;
import org.springframework.retry.support.RetryTemplate;
import org.springframework.util.Assert;
/**
@ -117,15 +118,15 @@ public abstract class AbstractRabbitListenerContainerFactoryConfigurer<T extends
}
ListenerRetry retryConfig = configuration.getRetry();
if (retryConfig.isEnabled()) {
RetryInterceptorBuilder<?> builder = (retryConfig.isStateless()
RetryInterceptorBuilder<?> builder = (retryConfig.isStateless())
? RetryInterceptorBuilder.stateless()
: RetryInterceptorBuilder.stateful());
builder.retryOperations(
new RetryTemplateFactory(this.retryTemplateCustomizers)
.createRetryTemplate(retryConfig,
RabbitRetryTemplateCustomizer.Target.LISTENER));
MessageRecoverer recoverer = (this.messageRecoverer != null
? this.messageRecoverer : new RejectAndDontRequeueRecoverer());
: RetryInterceptorBuilder.stateful();
RetryTemplate retryTemplate = new RetryTemplateFactory(
this.retryTemplateCustomizers).createRetryTemplate(retryConfig,
RabbitRetryTemplateCustomizer.Target.LISTENER);
builder.retryOperations(retryTemplate);
MessageRecoverer recoverer = (this.messageRecoverer != null)
? this.messageRecoverer : new RejectAndDontRequeueRecoverer();
builder.recoverer(recoverer);
factory.setAdviceChain(builder.build());
}

@ -195,7 +195,7 @@ public class RabbitAutoConfiguration {
private boolean determineMandatoryFlag() {
Boolean mandatory = this.properties.getTemplate().getMandatory();
return (mandatory != null ? mandatory : this.properties.isPublisherReturns());
return (mandatory != null) ? mandatory : this.properties.isPublisherReturns();
}
@Bean

@ -206,7 +206,7 @@ public class RabbitProperties {
return this.username;
}
Address address = this.parsedAddresses.get(0);
return (address.username != null ? address.username : this.username);
return (address.username != null) ? address.username : this.username;
}
public void setUsername(String username) {
@ -229,7 +229,7 @@ public class RabbitProperties {
return getPassword();
}
Address address = this.parsedAddresses.get(0);
return (address.password != null ? address.password : getPassword());
return (address.password != null) ? address.password : getPassword();
}
public void setPassword(String password) {
@ -256,7 +256,7 @@ public class RabbitProperties {
return getVirtualHost();
}
Address address = this.parsedAddresses.get(0);
return (address.virtualHost != null ? address.virtualHost : getVirtualHost());
return (address.virtualHost != null) ? address.virtualHost : getVirtualHost();
}
public void setVirtualHost(String virtualHost) {

@ -36,8 +36,8 @@ public class CacheManagerCustomizers {
public CacheManagerCustomizers(
List<? extends CacheManagerCustomizer<?>> customizers) {
this.customizers = (customizers != null ? new ArrayList<>(customizers)
: Collections.emptyList());
this.customizers = (customizers != null) ? new ArrayList<>(customizers)
: Collections.emptyList();
}
/**

@ -147,8 +147,8 @@ public abstract class AbstractNestedCondition extends SpringBootCondition
private List<String[]> getConditionClasses(AnnotatedTypeMetadata metadata) {
MultiValueMap<String, Object> attributes = metadata
.getAllAnnotationAttributes(Conditional.class.getName(), true);
Object values = (attributes != null ? attributes.get("value") : null);
return (List<String[]>) (values != null ? values : Collections.emptyList());
Object values = (attributes != null) ? attributes.get("value") : null;
return (List<String[]>) ((values != null) ? values : Collections.emptyList());
}
private Condition getCondition(String conditionClassName) {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -46,8 +46,8 @@ class ConditionEvaluationReportAutoConfigurationImportListener
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = (beanFactory instanceof ConfigurableListableBeanFactory
? (ConfigurableListableBeanFactory) beanFactory : null);
this.beanFactory = (beanFactory instanceof ConfigurableListableBeanFactory)
? (ConfigurableListableBeanFactory) beanFactory : null;
}
}

@ -59,16 +59,6 @@ public final class ConditionMessage {
return !StringUtils.hasLength(this.message);
}
@Override
public String toString() {
return (this.message != null ? this.message : "");
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.message);
}
@Override
public boolean equals(Object obj) {
if (obj == null || !ConditionMessage.class.isInstance(obj)) {
@ -80,6 +70,16 @@ public final class ConditionMessage {
return ObjectUtils.nullSafeEquals(((ConditionMessage) obj).message, this.message);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.message);
}
@Override
public String toString() {
return (this.message != null) ? this.message : "";
}
/**
* Return a new {@link ConditionMessage} based on the instance and an appended
* message.
@ -358,7 +358,7 @@ public final class ConditionMessage {
* @return a built {@link ConditionMessage}
*/
public ConditionMessage items(Style style, Object... items) {
return items(style, items != null ? Arrays.asList(items) : null);
return items(style, (items != null) ? Arrays.asList(items) : null);
}
/**
@ -415,7 +415,7 @@ public final class ConditionMessage {
QUOTE {
@Override
protected String applyToItem(Object item) {
return (item != null ? "'" + item + "'" : null);
return (item != null) ? "'" + item + "'" : null;
}
};

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -122,12 +122,6 @@ public class ConditionOutcome {
return this.message;
}
@Override
public int hashCode() {
return Boolean.hashCode(this.match) * 31
+ ObjectUtils.nullSafeHashCode(this.message);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -144,9 +138,15 @@ public class ConditionOutcome {
return super.equals(obj);
}
@Override
public int hashCode() {
return Boolean.hashCode(this.match) * 31
+ ObjectUtils.nullSafeHashCode(this.message);
}
@Override
public String toString() {
return (this.message != null ? this.message.toString() : "");
return (this.message != null) ? this.message.toString() : "";
}
/**

@ -444,7 +444,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
}
public SearchStrategy getStrategy() {
return (this.strategy != null ? this.strategy : SearchStrategy.ALL);
return (this.strategy != null) ? this.strategy : SearchStrategy.ALL;
}
public List<String> getNames() {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -53,7 +53,7 @@ class OnJavaCondition extends SpringBootCondition {
JavaVersion version) {
boolean match = isWithin(runningVersion, range, version);
String expected = String.format(
range != Range.EQUAL_OR_NEWER ? "(older than %s)" : "(%s or newer)",
(range != Range.EQUAL_OR_NEWER) ? "(older than %s)" : "(%s or newer)",
version);
ConditionMessage message = ConditionMessage
.forCondition(ConditionalOnJava.class, expected)

@ -139,7 +139,7 @@ class OnPropertyCondition extends SpringBootCondition {
"The name or value attribute of @ConditionalOnProperty must be specified");
Assert.state(value.length == 0 || name.length == 0,
"The name and value attributes of @ConditionalOnProperty are exclusive");
return (value.length > 0 ? value : name);
return (value.length > 0) ? value : name;
}
private void collectProperties(PropertyResolver resolver, List<String> missing,

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -46,8 +46,8 @@ class OnResourceCondition extends SpringBootCondition {
AnnotatedTypeMetadata metadata) {
MultiValueMap<String, Object> attributes = metadata
.getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true);
ResourceLoader loader = (context.getResourceLoader() != null
? context.getResourceLoader() : this.defaultResourceLoader);
ResourceLoader loader = (context.getResourceLoader() != null)
? context.getResourceLoader() : this.defaultResourceLoader;
List<String> locations = new ArrayList<>();
collectValues(locations, attributes.get("resources"));
Assert.isTrue(!locations.isEmpty(),

@ -194,8 +194,8 @@ public class CouchbaseProperties {
private String keyStorePassword;
public Boolean getEnabled() {
return (this.enabled != null ? this.enabled
: StringUtils.hasText(this.keyStore));
return (this.enabled != null) ? this.enabled
: StringUtils.hasText(this.keyStore);
}
public void setEnabled(Boolean enabled) {

@ -87,7 +87,7 @@ class NoSuchBeanDefinitionFailureAnalyzer
cause);
StringBuilder message = new StringBuilder();
message.append(String.format("%s required %s that could not be found.%n",
(description != null ? description : "A component"),
(description != null) ? description : "A component",
getBeanDescription(cause)));
for (AutoConfigurationResult result : autoConfigurationResults) {
message.append(String.format("\t- %s%n", result));
@ -97,9 +97,8 @@ class NoSuchBeanDefinitionFailureAnalyzer
}
String action = String.format("Consider %s %s in your configuration.",
(!autoConfigurationResults.isEmpty()
|| !userConfigurationResults.isEmpty()
? "revisiting the entries above or defining"
: "defining"),
|| !userConfigurationResults.isEmpty())
? "revisiting the entries above or defining" : "defining",
getBeanDescription(cause));
return new FailureAnalysis(message.toString(), action, cause);
}
@ -193,8 +192,8 @@ class NoSuchBeanDefinitionFailureAnalyzer
Source(String source) {
String[] tokens = source.split("#");
this.className = (tokens.length > 1 ? tokens[0] : source);
this.methodName = (tokens.length != 2 ? null : tokens[1]);
this.className = (tokens.length > 1) ? tokens[0] : source;
this.methodName = (tokens.length != 2) ? null : tokens[1];
}
public String getClassName() {
@ -254,8 +253,8 @@ class NoSuchBeanDefinitionFailureAnalyzer
private boolean hasName(MethodMetadata methodMetadata, String name) {
Map<String, Object> attributes = methodMetadata
.getAnnotationAttributes(Bean.class.getName());
String[] candidates = (attributes != null ? (String[]) attributes.get("name")
: null);
String[] candidates = (attributes != null) ? (String[]) attributes.get("name")
: null;
if (candidates != null) {
for (String candidate : candidates) {
if (candidate.equals(name)) {

@ -179,7 +179,7 @@ public class FlywayAutoConfiguration {
private String getProperty(Supplier<String> property,
Supplier<String> defaultValue) {
String value = property.get();
return (value != null ? value : defaultValue.get());
return (value != null) ? value : defaultValue.get();
}
private void checkLocationExists(String... locations) {

@ -109,7 +109,7 @@ public class FlywayProperties {
}
public String getPassword() {
return (this.password != null ? this.password : "");
return (this.password != null) ? this.password : "";
}
public void setPassword(String password) {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -104,7 +104,7 @@ public class HttpEncodingProperties {
}
public boolean shouldForce(Type type) {
Boolean force = (type != Type.REQUEST ? this.forceResponse : this.forceRequest);
Boolean force = (type != Type.REQUEST) ? this.forceResponse : this.forceRequest;
if (force == null) {
force = this.force;
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -69,7 +69,7 @@ public class HttpMessageConvertersAutoConfiguration {
@ConditionalOnMissingBean
public HttpMessageConverters messageConverters() {
return new HttpMessageConverters(
this.converters != null ? this.converters : Collections.emptyList());
(this.converters != null) ? this.converters : Collections.emptyList());
}
@Configuration

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -91,7 +91,7 @@ public class ProjectInfoAutoConfiguration {
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
ResourceLoader loader = context.getResourceLoader();
loader = (loader != null ? loader : this.defaultResourceLoader);
loader = (loader != null) ? loader : this.defaultResourceLoader;
Environment environment = context.getEnvironment();
String location = environment.getProperty("spring.info.git.location");
if (location == null) {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -121,7 +121,7 @@ public class DataSourceAutoConfiguration {
private ClassLoader getDataSourceClassLoader(ConditionContext context) {
Class<?> dataSourceClass = DataSourceBuilder
.findType(context.getClassLoader());
return (dataSourceClass != null ? dataSourceClass.getClassLoader() : null);
return (dataSourceClass != null) ? dataSourceClass.getClassLoader() : null;
}
}

@ -68,8 +68,8 @@ class DataSourceInitializer {
ResourceLoader resourceLoader) {
this.dataSource = dataSource;
this.properties = properties;
this.resourceLoader = (resourceLoader != null ? resourceLoader
: new DefaultResourceLoader());
this.resourceLoader = (resourceLoader != null) ? resourceLoader
: new DefaultResourceLoader();
}
/**

@ -277,8 +277,8 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
return this.url;
}
String databaseName = determineDatabaseName();
String url = (databaseName != null
? this.embeddedDatabaseConnection.getUrl(databaseName) : null);
String url = (databaseName != null)
? this.embeddedDatabaseConnection.getUrl(databaseName) : null;
if (!StringUtils.hasText(url)) {
throw new DataSourceBeanCreationException(
"Failed to determine suitable jdbc url", this,

@ -188,9 +188,9 @@ public class JmsProperties {
public String formatConcurrency() {
if (this.concurrency == null) {
return (this.maxConcurrency != null ? "1-" + this.maxConcurrency : null);
return (this.maxConcurrency != null) ? "1-" + this.maxConcurrency : null;
}
return (this.maxConcurrency != null
return ((this.maxConcurrency != null)
? this.concurrency + "-" + this.maxConcurrency
: String.valueOf(this.concurrency));
}

@ -48,8 +48,8 @@ class ActiveMQConnectionFactoryFactory {
List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
Assert.notNull(properties, "Properties must not be null");
this.properties = properties;
this.factoryCustomizers = (factoryCustomizers != null ? factoryCustomizers
: Collections.emptyList());
this.factoryCustomizers = (factoryCustomizers != null) ? factoryCustomizers
: Collections.emptyList();
}
public <T extends ActiveMQConnectionFactory> T createConnectionFactory(

@ -177,7 +177,7 @@ public class LiquibaseAutoConfiguration {
private String getProperty(Supplier<String> property,
Supplier<String> defaultValue) {
String value = property.get();
return (value != null ? value : defaultValue.get());
return (value != null) ? value : defaultValue.get();
}
}

@ -81,8 +81,8 @@ public class MongoClientFactory {
if (options == null) {
options = MongoClientOptions.builder().build();
}
String host = (this.properties.getHost() != null ? this.properties.getHost()
: "localhost");
String host = (this.properties.getHost() != null) ? this.properties.getHost()
: "localhost";
return new MongoClient(Collections.singletonList(new ServerAddress(host, port)),
options);
}
@ -101,8 +101,8 @@ public class MongoClientFactory {
int port = getValue(properties.getPort(), MongoProperties.DEFAULT_PORT);
List<ServerAddress> seeds = Collections
.singletonList(new ServerAddress(host, port));
return (credentials != null ? new MongoClient(seeds, credentials, options)
: new MongoClient(seeds, options));
return (credentials != null) ? new MongoClient(seeds, credentials, options)
: new MongoClient(seeds, options);
}
return createMongoClient(MongoProperties.DEFAULT_URI, options);
}
@ -112,7 +112,7 @@ public class MongoClientFactory {
}
private <T> T getValue(T value, T fallback) {
return (value != null ? value : fallback);
return (value != null) ? value : fallback;
}
private boolean hasCustomAddress() {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@ -143,7 +143,7 @@ public class MongoProperties {
}
public String determineUri() {
return (this.uri != null ? this.uri : DEFAULT_URI);
return (this.uri != null) ? this.uri : DEFAULT_URI;
}
public void setUri(String uri) {

@ -54,8 +54,8 @@ public class ReactiveMongoClientFactory {
List<MongoClientSettingsBuilderCustomizer> builderCustomizers) {
this.properties = properties;
this.environment = environment;
this.builderCustomizers = (builderCustomizers != null ? builderCustomizers
: Collections.emptyList());
this.builderCustomizers = (builderCustomizers != null) ? builderCustomizers
: Collections.emptyList();
}
/**
@ -86,8 +86,8 @@ public class ReactiveMongoClientFactory {
private MongoClient createEmbeddedMongoClient(MongoClientSettings settings,
int port) {
Builder builder = builder(settings);
String host = (this.properties.getHost() != null ? this.properties.getHost()
: "localhost");
String host = (this.properties.getHost() != null) ? this.properties.getHost()
: "localhost";
ClusterSettings clusterSettings = ClusterSettings.builder()
.hosts(Collections.singletonList(new ServerAddress(host, port))).build();
builder.clusterSettings(clusterSettings);
@ -119,16 +119,16 @@ public class ReactiveMongoClientFactory {
}
private void applyCredentials(Builder builder) {
String database = (this.properties.getAuthenticationDatabase() != null
String database = (this.properties.getAuthenticationDatabase() != null)
? this.properties.getAuthenticationDatabase()
: this.properties.getMongoClientDatabase());
: this.properties.getMongoClientDatabase();
builder.credential((MongoCredential.createCredential(
this.properties.getUsername(), database, this.properties.getPassword())));
}
private <T> T getOrDefault(T value, T defaultValue) {
return (value != null ? value : defaultValue);
return (value != null) ? value : defaultValue;
}
private MongoClient createMongoClient(Builder builder) {

@ -130,13 +130,12 @@ public class EmbeddedMongoAutoConfiguration {
this.embeddedProperties.getFeatures().toArray(new Feature[0]));
MongodConfigBuilder builder = new MongodConfigBuilder()
.version(featureAwareVersion);
if (this.embeddedProperties.getStorage() != null) {
builder.replication(
new Storage(this.embeddedProperties.getStorage().getDatabaseDir(),
this.embeddedProperties.getStorage().getReplSetName(),
this.embeddedProperties.getStorage().getOplogSize() != null
? this.embeddedProperties.getStorage().getOplogSize()
: 0));
EmbeddedMongoProperties.Storage storage = this.embeddedProperties.getStorage();
if (storage != null) {
String databaseDir = storage.getDatabaseDir();
String replSetName = storage.getReplSetName();
int oplogSize = (storage.getOplogSize() != null) ? storage.getOplogSize() : 0;
builder.replication(new Storage(databaseDir, replSetName, oplogSize));
}
Integer configuredPort = this.properties.getPort();
if (configuredPort != null && configuredPort > 0) {

@ -88,8 +88,8 @@ class DataSourceInitializedPublisher implements BeanPostProcessor {
private DataSource findDataSource(EntityManagerFactory entityManagerFactory) {
Object dataSource = entityManagerFactory.getProperties()
.get("javax.persistence.nonJtaDataSource");
return (dataSource != null && dataSource instanceof DataSource
? (DataSource) dataSource : this.dataSource);
return (dataSource != null && dataSource instanceof DataSource)
? (DataSource) dataSource : this.dataSource;
}
private boolean isInitializingDatabase(DataSource dataSource) {

@ -38,7 +38,7 @@ public class HibernateSettings {
}
public String getDdlAuto() {
return (this.ddlAuto != null ? this.ddlAuto.get() : null);
return (this.ddlAuto != null) ? this.ddlAuto.get() : null;
}
public HibernateSettings hibernatePropertiesCustomizers(

@ -155,7 +155,7 @@ public class QuartzAutoConfiguration {
private DataSource getDataSource(DataSource dataSource,
ObjectProvider<DataSource> quartzDataSource) {
DataSource dataSourceIfAvailable = quartzDataSource.getIfAvailable();
return (dataSourceIfAvailable != null ? dataSourceIfAvailable : dataSource);
return (dataSourceIfAvailable != null) ? dataSourceIfAvailable : dataSource;
}
@Bean

@ -102,15 +102,15 @@ public final class OAuth2ClientPropertiesRegistrationAdapter {
private static Builder getBuilder(String registrationId, String configuredProviderId,
Map<String, Provider> providers) {
String providerId = (configuredProviderId != null ? configuredProviderId
: registrationId);
String providerId = (configuredProviderId != null) ? configuredProviderId
: registrationId;
CommonOAuth2Provider provider = getCommonProvider(providerId);
if (provider == null && !providers.containsKey(providerId)) {
throw new IllegalStateException(
getErrorMessage(configuredProviderId, registrationId));
}
Builder builder = (provider != null ? provider.getBuilder(registrationId)
: ClientRegistration.withRegistrationId(registrationId));
Builder builder = (provider != null) ? provider.getBuilder(registrationId)
: ClientRegistration.withRegistrationId(registrationId);
if (providers.containsKey(providerId)) {
return getBuilder(builder, providers.get(providerId));
}
@ -119,7 +119,7 @@ public final class OAuth2ClientPropertiesRegistrationAdapter {
private static String getErrorMessage(String configuredProviderId,
String registrationId) {
return (configuredProviderId != null
return ((configuredProviderId != null)
? "Unknown provider ID '" + configuredProviderId + "'"
: "Provider ID must be specified for client registration '"
+ registrationId + "'");

@ -93,7 +93,7 @@ final class SessionStoreMappings {
}
private String getName(Class<?> configuration) {
return (configuration != null ? configuration.getName() : null);
return (configuration != null) ? configuration.getName() : null;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save