Upgrade to spring-javaformat 0.0.6

pull/14801/head
Phillip Webb 6 years ago
parent 17de1571f5
commit 9543fcf44d

@ -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.
@ -56,9 +56,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(new Date(), principal, type, data);
@ -67,9 +67,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(new Date(), principal, type, convert(data));
@ -77,17 +77,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(Date 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);
}

@ -114,11 +114,10 @@ public class EndpointAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public HealthEndpoint healthEndpoint() {
HealthAggregator healthAggregator = (this.healthAggregator != null
? this.healthAggregator : new OrderedHealthAggregator());
Map<String, HealthIndicator> healthIndicators = (this.healthIndicators != null
? this.healthIndicators
: Collections.<String, HealthIndicator>emptyMap());
HealthAggregator healthAggregator = (this.healthAggregator != null)
? this.healthAggregator : new OrderedHealthAggregator();
Map<String, HealthIndicator> healthIndicators = (this.healthIndicators != null)
? this.healthIndicators : Collections.<String, HealthIndicator>emptyMap();
return new HealthEndpoint(healthAggregator, healthIndicators);
}
@ -131,7 +130,7 @@ public class EndpointAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public InfoEndpoint infoEndpoint() throws Exception {
return new InfoEndpoint(this.infoContributors != null ? this.infoContributors
return new InfoEndpoint((this.infoContributors != null) ? this.infoContributors
: Collections.<InfoContributor>emptyList());
}
@ -156,7 +155,7 @@ public class EndpointAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public TraceEndpoint traceEndpoint() {
return new TraceEndpoint(this.traceRepository != null ? this.traceRepository
return new TraceEndpoint((this.traceRepository != null) ? this.traceRepository
: new InMemoryTraceRepository());
}

@ -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.
@ -376,8 +376,8 @@ public class EndpointWebMvcAutoConfiguration
}
return ((managementPort == null)
|| (serverPort == null && managementPort.equals(8080))
|| (managementPort != 0 && managementPort.equals(serverPort)) ? SAME
: DIFFERENT);
|| (managementPort != 0) && managementPort.equals(serverPort)) ? SAME
: DIFFERENT;
}
private static <T> T getTemporaryBean(BeanFactory beanFactory, Class<T> type) {

@ -340,7 +340,7 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
private String getPath(ServletServerHttpRequest request) {
String path = (String) request.getServletRequest()
.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
return (path != null ? path : "");
return (path != null) ? path : "";
}
}
@ -355,8 +355,9 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
@SuppressWarnings("unchecked")
EndpointResource(Object content, String path) {
this.content = (content instanceof Map ? null : content);
this.embedded = (Map<String, Object>) (this.content != null ? null : content);
this.content = (content instanceof Map) ? null : content;
this.embedded = (Map<String, Object>) ((this.content != null) ? null
: content);
add(linkTo(Object.class).slash(path).withSelfRel());
}

@ -89,8 +89,8 @@ public class EndpointWebMvcManagementContextConfiguration {
this.corsProperties = corsProperties;
List<EndpointHandlerMappingCustomizer> providedCustomizers = mappingCustomizers
.getIfAvailable();
this.mappingCustomizers = (providedCustomizers != null ? providedCustomizers
: Collections.<EndpointHandlerMappingCustomizer>emptyList());
this.mappingCustomizers = (providedCustomizers != null) ? providedCustomizers
: Collections.<EndpointHandlerMappingCustomizer>emptyList();
}
@Bean

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

@ -74,7 +74,7 @@ class LinksEnhancer {
private void addEndpointLink(ResourceSupport resource, MvcEndpoint endpoint,
String rel) {
Class<?> type = endpoint.getEndpointType();
type = (type != null ? type : Object.class);
type = (type != null) ? type : Object.class;
if (StringUtils.hasText(rel)) {
String href = this.rootPath + endpoint.getPath();
resource.add(linkTo(type).slash(href).withRel(rel));

@ -111,9 +111,9 @@ class ManagementContextConfigurationsImportSelector
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() {

@ -95,7 +95,7 @@ public class MetricExportAutoConfiguration {
exporters.setReader(reader);
exporters.setWriters(writers);
}
exporters.setExporters(this.exporters != null ? this.exporters
exporters.setExporters((this.exporters != null) ? this.exporters
: Collections.<String, Exporter>emptyMap());
return exporters;
}
@ -128,7 +128,7 @@ public class MetricExportAutoConfiguration {
public MetricExportProperties metricExportProperties() {
MetricExportProperties export = new MetricExportProperties();
export.getRedis().setPrefix("spring.metrics"
+ (this.prefix.length() > 0 ? "." : "") + this.prefix);
+ ((this.prefix.length() > 0) ? "." : "") + this.prefix);
export.getAggregate().setPrefix(this.prefix);
export.getAggregate().setKeyPattern(this.aggregateKeyPattern);
return export;

@ -89,9 +89,9 @@ public class PublicMetricsAutoConfiguration {
@Bean
public MetricReaderPublicMetrics metricReaderPublicMetrics() {
MetricReader[] readers = (this.metricReaders != null
MetricReader[] readers = (this.metricReaders != null)
? this.metricReaders.toArray(new MetricReader[this.metricReaders.size()])
: new MetricReader[0]);
: new MetricReader[0];
return new MetricReaderPublicMetrics(new CompositeMetricReader(readers));
}

@ -38,7 +38,7 @@ import org.springframework.cache.CacheManager;
* Base {@link CacheStatisticsProvider} implementation that uses JMX to retrieve the cache
* statistics.
*
* @param <C> The cache type
* @param <C> the cache type
* @author Stephane Nicoll
* @since 1.3.0
*/
@ -56,7 +56,7 @@ public abstract class AbstractJmxCacheStatisticsProvider<C extends Cache>
public CacheStatistics getCacheStatistics(CacheManager cacheManager, C cache) {
try {
ObjectName objectName = internalGetObjectName(cache);
return (objectName != null ? getCacheStatistics(objectName) : null);
return (objectName != null) ? getCacheStatistics(objectName) : null;
}
catch (MalformedObjectNameException ex) {
throw new IllegalStateException(ex);

@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 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.
@ -22,7 +22,7 @@ import org.springframework.cache.CacheManager;
/**
* Provide a {@link CacheStatistics} based on a {@link Cache}.
*
* @param <C> The {@link Cache} type
* @param <C> the {@link Cache} type
* @author Stephane Nicoll
* @author Phillip Webb
* @since 1.3.0

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 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.
@ -39,7 +39,7 @@ public class EhCacheStatisticsProvider implements CacheStatisticsProvider<EhCach
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);
double sanitizedHitRatio = (hitRatio > 1) ? 1 : hitRatio;
statistics.setHitRatio(sanitizedHitRatio);
statistics.setMissRatio(1 - sanitizedHitRatio);
}

@ -89,8 +89,8 @@ public class CloudFoundryActuatorAutoConfiguration {
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
boolean skipSslValidation = cloudFoundryProperties
.getProperty("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() {

@ -124,7 +124,7 @@ public class FlywayEndpoint extends AbstractEndpoint<List<FlywayReport>> {
}
private String nullSafeToString(Object obj) {
return (obj != null ? obj.toString() : null);
return (obj != null) ? obj.toString() : null;
}
public MigrationType getType() {

@ -84,7 +84,7 @@ public class LoggersEndpoint extends AbstractEndpoint<Map<String, Object>> {
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;
}
public void setLogLevel(String name, LogLevel level) {
@ -107,7 +107,7 @@ public class LoggersEndpoint extends AbstractEndpoint<Map<String, Object>> {
}
private String getName(LogLevel level) {
return (level != null ? level.name() : null);
return (level != null) ? level.name() : null;
}
public String getConfiguredLevel() {

@ -38,7 +38,7 @@ class DataConverter {
private final JavaType mapStringObject;
DataConverter(ObjectMapper objectMapper) {
this.objectMapper = (objectMapper != null ? objectMapper : new ObjectMapper());
this.objectMapper = (objectMapper != null) ? objectMapper : new ObjectMapper();
this.listObject = this.objectMapper.getTypeFactory()
.constructParametricType(List.class, Object.class);
this.mapStringObject = this.objectMapper.getTypeFactory()

@ -115,7 +115,7 @@ public class EndpointMBeanExporter extends MBeanExporter
* @param objectMapper the object mapper
*/
public EndpointMBeanExporter(ObjectMapper objectMapper) {
this.objectMapper = (objectMapper != null ? objectMapper : new ObjectMapper());
this.objectMapper = (objectMapper != null) ? objectMapper : new ObjectMapper();
setAutodetect(false);
setNamingStrategy(this.defaultNamingStrategy);
setAssembler(this.assembler);
@ -167,8 +167,8 @@ public class EndpointMBeanExporter extends MBeanExporter
for (Map.Entry<String, JmxEndpoint> entry : endpoints.entrySet()) {
String name = entry.getKey();
JmxEndpoint endpoint = entry.getValue();
Class<?> type = (endpoint.getEndpointType() != null
? endpoint.getEndpointType() : endpoint.getClass());
Class<?> type = (endpoint.getEndpointType() != null)
? endpoint.getEndpointType() : endpoint.getClass();
if (!this.registeredEndpoints.contains(type) && endpoint.isEnabled()) {
try {
registerBeanNameOrInstance(endpoint, name);

@ -55,7 +55,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
* MVC on the classpath). Note that any endpoints having method signatures will break in a
* non-servlet environment.
*
* @param <E> The endpoint type
* @param <E> the endpoint type
* @author Phillip Webb
* @author Christian Dupuis
* @author Dave Syer
@ -150,7 +150,7 @@ public abstract class AbstractEndpointHandlerMapping<E extends MvcEndpoint>
}
Assert.state(handler instanceof MvcEndpoint, "Only MvcEndpoints are supported");
String path = getPath((MvcEndpoint) handler);
return (path != null ? getEndpointPatterns(path, mapping) : null);
return (path != null) ? getEndpointPatterns(path, mapping) : null;
}
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 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.
@ -23,7 +23,7 @@ import org.springframework.util.Assert;
/**
* Abstract base class for {@link MvcEndpoint} implementations.
*
* @param <E> The delegate endpoint
* @param <E> the delegate endpoint
* @author Dave Syer
* @author Andy Wilkinson
* @author Phillip Webb
@ -67,7 +67,7 @@ public abstract class AbstractEndpointMvcAdapter<E extends Endpoint<?>>
@Override
public String getPath() {
return (this.path != null ? this.path : "/" + this.delegate.getId());
return (this.path != null) ? this.path : "/" + this.delegate.getId();
}
public void setPath(String path) {
@ -93,7 +93,7 @@ public abstract class AbstractEndpointMvcAdapter<E extends Endpoint<?>>
/**
* Returns the response that should be returned when the endpoint is disabled.
* @return The response to be returned when the endpoint is disabled
* @return the response to be returned when the endpoint is disabled
* @since 1.2.4
* @see Endpoint#isEnabled()
*/

@ -58,7 +58,7 @@ public class LoggersMvcEndpoint extends EndpointMvcAdapter {
return getDisabledResponse();
}
LoggerLevels levels = this.delegate.invoke(name);
return (levels != null ? levels : ResponseEntity.notFound().build());
return (levels != null) ? levels : ResponseEntity.notFound().build();
}
@ActuatorPostMapping("/{name:.*}")
@ -79,8 +79,8 @@ public class LoggersMvcEndpoint extends EndpointMvcAdapter {
private LogLevel getLogLevel(Map<String, String> configuration) {
String level = configuration.get("configuredLevel");
try {
return (level != null ? LogLevel.valueOf(level.toUpperCase(Locale.ENGLISH))
: null);
return (level != null) ? LogLevel.valueOf(level.toUpperCase(Locale.ENGLISH))
: null;
}
catch (IllegalArgumentException ex) {
throw new InvalidLogLevelException(level);

@ -99,7 +99,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());
}
}

@ -42,9 +42,9 @@ 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("solrStatus",
(statusCode != 0 ? statusCode : "OK"));
(statusCode != 0) ? statusCode : "OK");
}
}

@ -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;
}
}

@ -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.
@ -79,12 +79,6 @@ public class Metric<T extends Number> {
return this.timestamp;
}
@Override
public String toString() {
return "Metric [name=" + this.name + ", value=" + this.value + ", timestamp="
+ this.timestamp + "]";
}
/**
* Create a new {@link Metric} with an incremented value.
* @param amount the amount that the new metric will differ from this one
@ -105,16 +99,6 @@ public class Metric<T extends Number> {
return new Metric<S>(this.getName(), value);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ObjectUtils.nullSafeHashCode(this.name);
result = prime * result + ObjectUtils.nullSafeHashCode(this.timestamp);
result = prime * result + ObjectUtils.nullSafeHashCode(this.value);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -134,4 +118,20 @@ public class Metric<T extends Number> {
return super.equals(obj);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ObjectUtils.nullSafeHashCode(this.name);
result = prime * result + ObjectUtils.nullSafeHashCode(this.timestamp);
result = prime * result + ObjectUtils.nullSafeHashCode(this.value);
return result;
}
@Override
public String toString() {
return "Metric [name=" + this.name + ", value=" + this.value + ", timestamp="
+ this.timestamp + "]";
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 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.
@ -144,12 +144,12 @@ public class AggregateMetricReader implements MetricReader {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < patterns.length; i++) {
if ("k".equals(patterns[i])) {
builder.append(builder.length() > 0 ? "." : "");
builder.append((builder.length() > 0) ? "." : "");
builder.append(keys[i]);
}
}
for (int i = patterns.length; i < keys.length; i++) {
builder.append(builder.length() > 0 ? "." : "");
builder.append((builder.length() > 0) ? "." : "");
builder.append(keys[i]);
}
return builder.toString();

@ -55,7 +55,7 @@ public class BufferMetricReader implements MetricReader, PrefixMetricReader {
if (buffer == null) {
buffer = this.gaugeBuffers.find(name);
}
return (buffer != null ? asMetric(name, buffer) : null);
return (buffer != null) ? asMetric(name, buffer) : null;
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 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.
@ -29,7 +29,7 @@ import org.springframework.lang.UsesJava8;
*
* @author Dave Syer
* @author Phillip Webb
* @param <B> The buffer type
* @param <B> the buffer type
*/
@UsesJava8
abstract class Buffers<B extends Buffer<?>> {

@ -80,8 +80,8 @@ public class DropwizardMetricServices implements CounterService, GaugeService {
public DropwizardMetricServices(MetricRegistry registry,
ReservoirFactory reservoirFactory) {
this.registry = registry;
this.reservoirFactory = (reservoirFactory != null ? reservoirFactory
: ReservoirFactory.NONE);
this.reservoirFactory = (reservoirFactory != null) ? reservoirFactory
: ReservoirFactory.NONE;
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 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.
@ -52,7 +52,7 @@ public class DefaultMetricNamingStrategy implements ObjectNamingStrategy {
String[] parts = StringUtils.delimitedListToStringArray(name, ".");
table.put("type", parts[0]);
if (parts.length > 1) {
table.put(parts.length > 2 ? "name" : "value", parts[1]);
table.put((parts.length > 2) ? "name" : "value", parts[1]);
}
if (parts.length > 2) {
table.put("value",

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 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.
@ -126,7 +126,7 @@ public final class RichGauge {
/**
* Return either an exponential weighted moving average or a simple mean,
* respectively, depending on whether the weight 'alpha' has been set for this gauge.
* @return The average over all the accumulated values
* @return the average over all the accumulated values
*/
public double getAverage() {
return this.average;

@ -70,7 +70,7 @@ public class StatsdMetricWriter implements MetricWriter, Closeable {
/**
* Create a new writer with the given client.
* @param client StatsD client to write metrics with
* @param client the StatsD client to write metrics with
*/
public StatsdMetricWriter(StatsDClient client) {
Assert.notNull(client, "client must not be null");
@ -121,8 +121,8 @@ public class StatsdMetricWriter implements MetricWriter, Closeable {
/**
* Sanitize the metric name if necessary.
* @param name The metric name
* @return The sanitized metric name
* @param name the metric name
* @return the sanitized metric name
*/
private String sanitizeMetricName(String name) {
return name.replace(":", "-");

@ -62,7 +62,7 @@ public final class MetricWriterMessageHandler implements MessageHandler {
else {
if (logger.isWarnEnabled()) {
logger.warn("Unsupported metric payload "
+ (payload != null ? payload.getClass().getName() : "null"));
+ ((payload != null) ? payload.getClass().getName() : "null"));
}
}
}

@ -114,7 +114,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order
finally {
addTimeTaken(trace, startTime);
addSessionIdIfNecessary(request, trace);
enhanceTrace(trace, status != response.getStatus()
enhanceTrace(trace, (status != response.getStatus())
? new CustomStatusResponseWrapper(response, status) : response);
this.repository.add(trace);
}
@ -124,7 +124,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order
Map<String, Object> trace) {
HttpSession session = request.getSession(false);
add(trace, Include.SESSION_ID, "sessionId",
(session != null ? session.getId() : null));
(session != null) ? session.getId() : null);
}
protected Map<String, Object> getTrace(HttpServletRequest request) {
@ -144,7 +144,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order
request.getPathTranslated());
add(trace, Include.CONTEXT_PATH, "contextPath", request.getContextPath());
add(trace, Include.USER_PRINCIPAL, "userPrincipal",
(userPrincipal != null ? userPrincipal.getName() : null));
(userPrincipal != null) ? userPrincipal.getName() : null);
if (isIncluded(Include.PARAMETERS)) {
trace.put("parameters", getParameterMapCopy(request));
}

@ -128,7 +128,7 @@ public class EndpointMvcIntegrationTests {
@Bean
@ConditionalOnMissingBean
public HttpMessageConverters messageConverters() {
return new HttpMessageConverters(this.converters != null ? this.converters
return new HttpMessageConverters((this.converters != null) ? this.converters
: Collections.<HttpMessageConverter<?>>emptyList());
}

@ -298,7 +298,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) {

@ -86,7 +86,7 @@ public class HalBrowserMvcEndpointDisabledIntegrationTests {
if ("/actuator".equals(path) || endpoint instanceof HeapdumpMvcEndpoint) {
continue;
}
path = (path.length() > 0 ? path : "/");
path = (path.length() > 0) ? path : "/";
MockHttpServletRequestBuilder requestBuilder = get(path);
if (endpoint instanceof AuditEventsMvcEndpoint) {
requestBuilder.param("after", "2016-01-01T12:00:00+00:00");

@ -112,7 +112,7 @@ public class HalBrowserMvcEndpointManagementContextPathIntegrationTests {
continue;
}
path = (path.startsWith("/") ? path.substring(1) : path);
path = (path.length() > 0 ? path : "self");
path = (path.length() > 0) ? path : "self";
this.mockMvc.perform(get("/admin").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$._links.%s.href", path)

@ -126,7 +126,7 @@ public class HalBrowserMvcEndpointVanillaIntegrationTests {
if (collections.contains(path)) {
continue;
}
path = (path.length() > 0 ? path : "/");
path = (path.length() > 0) ? path : "/";
this.mockMvc.perform(get(path).accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andExpect(jsonPath("$._links.self.href")
.value("http://localhost" + endpoint.getPath()));

@ -232,7 +232,7 @@ public class AutoConfigurationImportSelector
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(getEnvironment(),
"spring.autoconfigure.");
String[] exclude = resolver.getProperty("exclude", String[].class);
return (Arrays.asList(exclude != null ? exclude : new String[0]));
return Arrays.asList((exclude != null) ? exclude : new String[0]);
}
private List<String> sort(List<String> configurations,
@ -298,7 +298,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;
}
}

@ -150,9 +150,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
@ -163,8 +162,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

@ -66,7 +66,7 @@ class AutoConfigurationSorter {
public int compare(String o1, String o2) {
int i1 = classes.get(o1).getOrder();
int i2 = classes.get(o2).getOrder();
return (i1 < i2 ? -1 : (i1 > i2 ? 1 : 0));
return (i1 < i2) ? -1 : (i1 > i2) ? 1 : 0;
}
});
@ -174,8 +174,8 @@ class AutoConfigurationSorter {
}
Map<String, Object> attributes = getAnnotationMetadata()
.getAnnotationAttributes(AutoConfigureOrder.class.getName());
return (attributes != null ? (Integer) attributes.get("value")
: Ordered.LOWEST_PRECEDENCE);
return (attributes != null) ? (Integer) attributes.get("value")
: Ordered.LOWEST_PRECEDENCE;
}
private Set<String> readBefore() {

@ -111,8 +111,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());

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 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.
@ -189,7 +189,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();
}
private RetryTemplate createRetryTemplate(RabbitProperties.Retry properties) {

@ -203,7 +203,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) {
@ -226,7 +226,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) {
@ -253,7 +253,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) {

@ -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.
@ -113,8 +113,8 @@ public final class SimpleRabbitListenerContainerFactoryConfigurer {
builder.maxAttempts(retryConfig.getMaxAttempts());
builder.backOffOptions(retryConfig.getInitialInterval(),
retryConfig.getMultiplier(), retryConfig.getMaxInterval());
MessageRecoverer recoverer = (this.messageRecoverer != null
? this.messageRecoverer : new RejectAndDontRequeueRecoverer());
MessageRecoverer recoverer = (this.messageRecoverer != null)
? this.messageRecoverer : new RejectAndDontRequeueRecoverer();
builder.recoverer(recoverer);
factory.setAdviceChain(builder.build());
}

@ -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.
@ -41,9 +41,9 @@ public class CacheManagerCustomizers {
public CacheManagerCustomizers(
List<? extends CacheManagerCustomizer<?>> customizers) {
this.customizers = (customizers != null
this.customizers = (customizers != null)
? new ArrayList<CacheManagerCustomizer<?>>(customizers)
: Collections.<CacheManagerCustomizer<?>>emptyList());
: Collections.<CacheManagerCustomizer<?>>emptyList();
}
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 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.
@ -146,8 +146,8 @@ 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.
@ -359,7 +359,7 @@ public final class ConditionMessage {
*/
public ConditionMessage items(Style style, Object... items) {
return items(style,
items != null ? Arrays.asList(items) : (Collection<?>) null);
(items != null) ? Arrays.asList(items) : (Collection<?>) null);
}
/**
@ -416,7 +416,7 @@ public final class ConditionMessage {
QUOTE {
@Override
protected String applyToItem(Object item) {
return (item != null ? "'" + item + "'" : null);
return (item != null) ? "'" + item + "'" : null;
}
};

@ -122,12 +122,6 @@ public class ConditionOutcome {
return this.message;
}
@Override
public int hashCode() {
return ObjectUtils.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 ObjectUtils.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() : "";
}
/**

@ -365,7 +365,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() {

@ -53,7 +53,7 @@ class OnJavaCondition extends SpringBootCondition {
JavaVersion version) {
boolean match = runningVersion.isWithin(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)

@ -145,7 +145,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,

@ -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<String>();
collectValues(locations, attributes.get("resources"));
Assert.isTrue(!locations.isEmpty(),

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 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.
@ -174,8 +174,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) {

@ -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.
@ -50,7 +50,7 @@ public class PersistenceExceptionTranslationAutoConfiguration {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
"spring.aop.");
Boolean value = resolver.getProperty("proxyTargetClass", Boolean.class);
return (value != null ? value : true);
return (value != null) ? value : true;
}
}

@ -195,9 +195,8 @@ public class RedisAutoConfiguration {
}
private JedisConnectionFactory createJedisConnectionFactory() {
JedisPoolConfig poolConfig = (this.properties.getPool() != null
? jedisPoolConfig() : new JedisPoolConfig());
JedisPoolConfig poolConfig = (this.properties.getPool() != null)
? jedisPoolConfig() : new JedisPoolConfig();
if (getSentinelConfig() != null) {
return new JedisConnectionFactory(getSentinelConfig(), poolConfig);
}

@ -80,7 +80,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)));
if (!autoConfigurationResults.isEmpty()) {
for (AutoConfigurationResult provider : autoConfigurationResults) {
@ -164,8 +164,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() {
@ -225,8 +225,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)) {

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

@ -184,7 +184,7 @@ public class DataSourceAutoConfiguration {
private ClassLoader getDataSourceClassLoader(ConditionContext context) {
Class<?> dataSourceClass = new DataSourceBuilder(context.getClassLoader())
.findType();
return (dataSourceClass != null ? dataSourceClass.getClassLoader() : null);
return (dataSourceClass != null) ? dataSourceClass.getClassLoader() : null;
}
}

@ -107,7 +107,7 @@ public enum EmbeddedDatabaseConnection {
*/
public String getUrl(String databaseName) {
Assert.hasText(databaseName, "DatabaseName must not be null.");
return (this.url != null ? String.format(this.url, databaseName) : null);
return (this.url != null) ? String.format(this.url, databaseName) : null;
}
/**

@ -41,9 +41,9 @@ public class DataSourcePoolMetadataProviders implements DataSourcePoolMetadataPr
*/
public DataSourcePoolMetadataProviders(
Collection<? extends DataSourcePoolMetadataProvider> providers) {
this.providers = (providers != null
this.providers = (providers != null)
? new ArrayList<DataSourcePoolMetadataProvider>(providers)
: Collections.<DataSourcePoolMetadataProvider>emptyList());
: Collections.<DataSourcePoolMetadataProvider>emptyList();
}
@Override

@ -34,7 +34,7 @@ public class TomcatDataSourcePoolMetadata
@Override
public Integer getActive() {
ConnectionPool pool = getDataSource().getPool();
return (pool != null ? pool.getActive() : 0);
return (pool != null) ? pool.getActive() : 0;
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 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.
@ -124,11 +124,11 @@ 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));
: 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.<ActiveMQConnectionFactoryCustomizer>emptyList());
this.factoryCustomizers = (factoryCustomizers != null) ? factoryCustomizers
: Collections.<ActiveMQConnectionFactoryCustomizer>emptyList();
}
public <T extends ActiveMQConnectionFactory> T createConnectionFactory(

@ -159,7 +159,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) {
@ -226,7 +226,7 @@ public class MongoProperties {
if (options == null) {
options = MongoClientOptions.builder().build();
}
String host = (this.host != null ? this.host : "localhost");
String host = (this.host != null) ? this.host : "localhost";
return new MongoClient(Collections.singletonList(new ServerAddress(host, port)),
Collections.<MongoCredential>emptyList(), options);
}
@ -242,13 +242,13 @@ public class MongoProperties {
}
List<MongoCredential> credentials = new ArrayList<MongoCredential>();
if (hasCustomCredentials()) {
String database = (this.authenticationDatabase != null
? this.authenticationDatabase : getMongoClientDatabase());
String database = (this.authenticationDatabase != null)
? this.authenticationDatabase : getMongoClientDatabase();
credentials.add(MongoCredential.createCredential(this.username, database,
this.password));
}
String host = (this.host != null ? this.host : "localhost");
int port = (this.port != null ? this.port : DEFAULT_PORT);
String host = (this.host != null) ? this.host : "localhost";
int port = (this.port != null) ? this.port : DEFAULT_PORT;
return new MongoClient(
Collections.singletonList(new ServerAddress(host, port)), credentials,
options);

@ -128,13 +128,13 @@ public class EmbeddedMongoAutoConfiguration {
this.embeddedProperties.getFeatures());
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));
org.springframework.boot.autoconfigure.mongo.embedded.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) {
@ -239,8 +239,8 @@ public class EmbeddedMongoAutoConfiguration {
Set<Feature> features) {
Assert.notNull(version, "version must not be null");
this.version = version;
this.features = (features != null ? features
: Collections.<Feature>emptySet());
this.features = (features != null) ? features
: Collections.<Feature>emptySet();
}
@Override
@ -253,20 +253,6 @@ public class EmbeddedMongoAutoConfiguration {
return this.features.contains(feature);
}
@Override
public String toString() {
return this.version;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + this.features.hashCode();
result = prime * result + this.version.hashCode();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -285,6 +271,20 @@ public class EmbeddedMongoAutoConfiguration {
return super.equals(obj);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + this.features.hashCode();
result = prime * result + this.version.hashCode();
return result;
}
@Override
public String toString() {
return this.version;
}
}
}

@ -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.
@ -81,8 +81,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) {

@ -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.
@ -210,8 +210,8 @@ public class JpaProperties {
private String getOrDeduceDdlAuto(Map<String, String> existing,
DataSource dataSource) {
String ddlAuto = (this.ddlAuto != null ? this.ddlAuto
: getDefaultDdlAuto(dataSource));
String ddlAuto = (this.ddlAuto != null) ? this.ddlAuto
: getDefaultDdlAuto(dataSource);
if (!existing.containsKey("hibernate." + "hbm2ddl.auto")
&& !"none".equals(ddlAuto)) {
return ddlAuto;

@ -283,7 +283,7 @@ public class SpringBootWebSecurityConfiguration {
private String[] getSecureApplicationPaths() {
List<String> list = new ArrayList<String>();
for (String path : this.security.getBasic().getPath()) {
path = (path != null ? path.trim() : "");
path = (path != null) ? path.trim() : "";
if (path.equals("/**")) {
return new String[] { path };
}

@ -70,7 +70,7 @@ public class DefaultUserInfoRestTemplateFactory implements UserInfoRestTemplateF
public OAuth2RestTemplate getUserInfoRestTemplate() {
if (this.oauth2RestTemplate == null) {
this.oauth2RestTemplate = createOAuth2RestTemplate(
this.details != null ? this.details : DEFAULT_RESOURCE_DETAILS);
(this.details != null) ? this.details : DEFAULT_RESOURCE_DETAILS);
this.oauth2RestTemplate.getInterceptors()
.add(new AcceptJsonRequestInterceptor());
AuthorizationCodeAccessTokenProvider accessTokenProvider = new AuthorizationCodeAccessTokenProvider();

@ -115,7 +115,7 @@ public class UserInfoTokenServices implements ResourceServerTokenServices {
*/
protected Object getPrincipal(Map<String, Object> map) {
Object principal = this.principalExtractor.extractPrincipal(map);
return (principal != null ? principal : "unknown");
return (principal != null) ? principal : "unknown";
}
@Override

@ -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.
@ -50,7 +50,7 @@ public class SessionProperties {
public SessionProperties(ObjectProvider<ServerProperties> serverProperties) {
ServerProperties properties = serverProperties.getIfUnique();
this.timeout = (properties != null ? properties.getSession().getTimeout() : null);
this.timeout = (properties != null) ? properties.getSession().getTimeout() : null;
}
public StoreType getStoreType() {

@ -70,7 +70,7 @@ public class FacebookAutoConfiguration {
public Facebook facebook(ConnectionRepository repository) {
Connection<Facebook> connection = repository
.findPrimaryConnection(Facebook.class);
return (connection != null ? connection.getApi() : null);
return (connection != null) ? connection.getApi() : null;
}
@Bean(name = { "connect/facebookConnect", "connect/facebookConnected" })

@ -70,7 +70,7 @@ public class LinkedInAutoConfiguration {
public LinkedIn linkedin(ConnectionRepository repository) {
Connection<LinkedIn> connection = repository
.findPrimaryConnection(LinkedIn.class);
return (connection != null ? connection.getApi() : null);
return (connection != null) ? connection.getApi() : null;
}
@Bean(name = { "connect/linkedinConnect", "connect/linkedinConnected" })

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 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.
@ -119,7 +119,7 @@ public abstract class AbstractViewResolverProperties {
}
public String getCharsetName() {
return (this.charset != null ? this.charset.name() : null);
return (this.charset != null) ? this.charset.name() : null;
}
public void setCharset(Charset charset) {

@ -76,7 +76,7 @@ public class TemplateAvailabilityProviders {
* @param applicationContext the source application context
*/
public TemplateAvailabilityProviders(ApplicationContext applicationContext) {
this(applicationContext != null ? applicationContext.getClassLoader() : null);
this((applicationContext != null) ? applicationContext.getClassLoader() : null);
}
/**
@ -144,12 +144,12 @@ public class TemplateAvailabilityProviders {
if (provider == null) {
synchronized (this.cache) {
provider = findProvider(view, environment, classLoader, resourceLoader);
provider = (provider != null ? provider : NONE);
provider = (provider != null) ? provider : NONE;
this.resolved.put(view, provider);
this.cache.put(view, provider);
}
}
return (provider != NONE ? provider : null);
return (provider != NONE) ? provider : null;
}
private TemplateAvailabilityProvider findProvider(String view,

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 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.
@ -23,7 +23,7 @@ import org.springframework.transaction.PlatformTransactionManager;
* {@link PlatformTransactionManager PlatformTransactionManagers} whilst retaining default
* auto-configuration.
*
* @param <T> The transaction manager type
* @param <T> the transaction manager type
* @author Phillip Webb
* @since 1.5.0
*/

@ -41,9 +41,9 @@ public class TransactionManagerCustomizers {
public TransactionManagerCustomizers(
Collection<? extends PlatformTransactionManagerCustomizer<?>> customizers) {
this.customizers = (customizers != null
this.customizers = (customizers != null)
? new ArrayList<PlatformTransactionManagerCustomizer<?>>(customizers)
: null);
: null;
}
public void customize(PlatformTransactionManager transactionManager) {

@ -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.
@ -72,7 +72,7 @@ public class ValidationAutoConfiguration {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
"spring.aop.");
Boolean value = resolver.getProperty("proxyTargetClass", Boolean.class);
return (value != null ? value : true);
return (value != null) ? value : true;
}
}

@ -90,7 +90,7 @@ public class BasicErrorController extends AbstractErrorController {
request, isIncludeStackTrace(request, MediaType.TEXT_HTML)));
response.setStatus(status.value());
ModelAndView modelAndView = resolveErrorView(request, response, status, model);
return (modelAndView != null ? modelAndView : new ModelAndView("error", model));
return (modelAndView != null) ? modelAndView : new ModelAndView("error", model);
}
@RequestMapping

@ -283,11 +283,12 @@ public class ErrorMvcAutoConfiguration {
@Override
public String resolvePlaceholder(String placeholderName) {
Expression expression = this.expressions.get(placeholderName);
return escape(expression != null ? expression.getValue(this.context) : null);
return escape(
(expression != null) ? expression.getValue(this.context) : null);
}
private String escape(Object value) {
return HtmlUtils.htmlEscape(value != null ? value.toString() : null);
return HtmlUtils.htmlEscape((value != null) ? value.toString() : null);
}
}

@ -102,7 +102,7 @@ public class HttpEncodingProperties {
}
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;
}

@ -64,7 +64,7 @@ public class HttpMessageConvertersAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public HttpMessageConverters messageConverters() {
return new HttpMessageConverters(this.converters != null ? this.converters
return new HttpMessageConverters((this.converters != null) ? this.converters
: Collections.<HttpMessageConverter<?>>emptyList());
}

@ -241,7 +241,7 @@ public class ResourceProperties implements ResourceLoaderAware, InitializingBean
static Boolean getEnabled(boolean fixedEnabled, boolean contentEnabled,
Boolean chainEnabled) {
return (fixedEnabled || contentEnabled ? Boolean.TRUE : chainEnabled);
return (fixedEnabled || contentEnabled) ? Boolean.TRUE : chainEnabled;
}
}

@ -382,7 +382,7 @@ public class ServerProperties
return this.useForwardHeaders;
}
CloudPlatform platform = CloudPlatform.getActive(this.environment);
return (platform != null ? platform.isUsingForwardHeaders() : false);
return (platform != null) ? platform.isUsingForwardHeaders() : false;
}
public Integer getConnectionTimeout() {
@ -830,8 +830,8 @@ public class ServerProperties
if (this.minSpareThreads > 0) {
customizeMinThreads(factory);
}
int maxHttpHeaderSize = (serverProperties.getMaxHttpHeaderSize() > 0
? serverProperties.getMaxHttpHeaderSize() : this.maxHttpHeaderSize);
int maxHttpHeaderSize = (serverProperties.getMaxHttpHeaderSize() > 0)
? serverProperties.getMaxHttpHeaderSize() : this.maxHttpHeaderSize;
if (maxHttpHeaderSize > 0) {
customizeMaxHttpHeaderSize(factory, maxHttpHeaderSize);
}

@ -381,7 +381,7 @@ public class WebMvcAutoConfiguration {
@Override
public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
RequestMappingHandlerAdapter adapter = super.requestMappingHandlerAdapter();
adapter.setIgnoreDefaultModelOnRedirect(this.mvcProperties != null
adapter.setIgnoreDefaultModelOnRedirect((this.mvcProperties != null)
? this.mvcProperties.isIgnoreDefaultModelOnRedirect() : true);
return adapter;
}

@ -96,8 +96,8 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
private List<String> getEntityManagerFactoryDependencies() {
String[] dependsOn = this.context.getBeanDefinition("entityManagerFactory")
.getDependsOn();
return (dependsOn != null ? Arrays.asList(dependsOn)
: Collections.<String>emptyList());
return (dependsOn != null) ? Arrays.asList(dependsOn)
: Collections.<String>emptyList();
}
public void load(Class<?> config) {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 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.
@ -51,9 +51,9 @@ public class SpringApplicationLauncher {
/**
* Launches the application created using the given {@code sources}. The application
* is launched with the given {@code args}.
* @param sources The sources for the application
* @param args The args for the application
* @return The application's {@code ApplicationContext}
* @param sources the sources for the application
* @param args the args for the application
* @return the application's {@code ApplicationContext}
* @throws Exception if the launch fails
*/
public Object launch(Object[] sources, String[] args) throws Exception {

@ -64,7 +64,7 @@ public class SpringApplicationWebApplicationInitializer
private Manifest getManifest(ServletContext servletContext) throws IOException {
InputStream stream = servletContext.getResourceAsStream("/META-INF/MANIFEST.MF");
Manifest manifest = (stream != null ? new Manifest(stream) : null);
Manifest manifest = (stream != null) ? new Manifest(stream) : null;
return manifest;
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 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.
@ -29,7 +29,7 @@ public interface CommandFactory {
/**
* Returns the CLI {@link Command}s.
* @return The commands
* @return the commands
*/
Collection<Command> getCommands();

@ -171,7 +171,7 @@ public class CommandRunner implements Iterable<Command> {
ExitStatus result = run(argsWithoutDebugFlags);
// The caller will hang up if it gets a non-zero status
if (result != null && result.isHangup()) {
return (result.getCode() > 0 ? result.getCode() : 0);
return (result.getCode() > 0) ? result.getCode() : 0;
}
return 0;
}
@ -260,7 +260,7 @@ public class CommandRunner implements Iterable<Command> {
}
protected boolean errorMessage(String message) {
Log.error(message != null ? message : "Unexpected error");
Log.error((message != null) ? message : "Unexpected error");
return message != null;
}
@ -280,8 +280,8 @@ public class CommandRunner implements Iterable<Command> {
String usageHelp = command.getUsageHelp();
String description = command.getDescription();
Log.info(String.format("%n %1$s %2$-15s%n %3$s", command.getName(),
(usageHelp != null ? usageHelp : ""),
(description != null ? description : "")));
(usageHelp != null) ? usageHelp : "",
(description != null) ? description : ""));
}
}
Log.info("");

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 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.
@ -30,7 +30,7 @@ public class HelpExample {
/**
* Create a new {@link HelpExample} instance.
* @param description The description (in the form "to ....")
* @param description the description (in the form "to ....")
* @param example the example
*/
public HelpExample(String description, String example) {

@ -239,7 +239,7 @@ abstract class ArchiveCommand extends OptionParsingCommand {
private String commaDelimitedClassNames(Class<?>[] classes) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < classes.length; i++) {
builder.append(i != 0 ? "," : "");
builder.append((i != 0) ? "," : "");
builder.append(classes[i].getName());
}
return builder.toString();

@ -107,7 +107,7 @@ public class HelpCommand extends AbstractCommand {
}
Collection<HelpExample> examples = command.getExamples();
if (examples != null) {
Log.info(examples.size() != 1 ? "examples:" : "example:");
Log.info((examples.size() != 1) ? "examples:" : "example:");
Log.info("");
for (HelpExample example : examples) {
Log.info(" " + example.getDescription() + ":");

@ -45,7 +45,7 @@ public class HintCommand extends AbstractCommand {
@Override
public ExitStatus run(String... args) throws Exception {
try {
int index = (args.length != 0 ? Integer.valueOf(args[0]) - 1 : 0);
int index = (args.length != 0) ? Integer.valueOf(args[0]) - 1 : 0;
List<String> arguments = new ArrayList<String>(args.length);
for (int i = 2; i < args.length; i++) {
arguments.add(args[i]);

@ -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.
@ -241,7 +241,7 @@ class InitializrService {
private String getContent(HttpEntity entity) throws IOException {
ContentType contentType = ContentType.getOrDefault(entity);
Charset charset = contentType.getCharset();
charset = (charset != null ? charset : UTF_8);
charset = (charset != null) ? charset : UTF_8;
byte[] content = FileCopyUtils.copyToByteArray(entity.getContent());
return new String(content, charset);
}

@ -418,7 +418,7 @@ class ProjectGenerationRequest {
}
if (this.output != null) {
int i = this.output.lastIndexOf('.');
return (i != -1 ? this.output.substring(0, i) : this.output);
return (i != -1) ? this.output.substring(0, i) : this.output;
}
return null;
}

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

Loading…
Cancel
Save