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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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. * 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 type the event type
* @param data The event data * @param data the event data
*/ */
public AuditEvent(String principal, String type, Map<String, Object> data) { public AuditEvent(String principal, String type, Map<String, Object> data) {
this(new Date(), principal, type, 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 * Create a new audit event for the current time from data provided as name-value
* pairs. * pairs.
* @param principal The user principal responsible * @param principal the user principal responsible
* @param type the event type * @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) { public AuditEvent(String principal, String type, String... data) {
this(new Date(), principal, type, convert(data)); this(new Date(), principal, type, convert(data));
@ -77,17 +77,17 @@ public class AuditEvent implements Serializable {
/** /**
* Create a new audit event. * Create a new audit event.
* @param timestamp The date/time of the event * @param timestamp the date/time of the event
* @param principal The user principal responsible * @param principal the user principal responsible
* @param type the event type * @param type the event type
* @param data The event data * @param data the event data
*/ */
public AuditEvent(Date timestamp, String principal, String type, public AuditEvent(Date timestamp, String principal, String type,
Map<String, Object> data) { Map<String, Object> data) {
Assert.notNull(timestamp, "Timestamp must not be null"); Assert.notNull(timestamp, "Timestamp must not be null");
Assert.notNull(type, "Type must not be null"); Assert.notNull(type, "Type must not be null");
this.timestamp = timestamp; this.timestamp = timestamp;
this.principal = (principal != null ? principal : ""); this.principal = (principal != null) ? principal : "";
this.type = type; this.type = type;
this.data = Collections.unmodifiableMap(data); this.data = Collections.unmodifiableMap(data);
} }

@ -114,11 +114,10 @@ public class EndpointAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public HealthEndpoint healthEndpoint() { public HealthEndpoint healthEndpoint() {
HealthAggregator healthAggregator = (this.healthAggregator != null HealthAggregator healthAggregator = (this.healthAggregator != null)
? this.healthAggregator : new OrderedHealthAggregator()); ? this.healthAggregator : new OrderedHealthAggregator();
Map<String, HealthIndicator> healthIndicators = (this.healthIndicators != null Map<String, HealthIndicator> healthIndicators = (this.healthIndicators != null)
? this.healthIndicators ? this.healthIndicators : Collections.<String, HealthIndicator>emptyMap();
: Collections.<String, HealthIndicator>emptyMap());
return new HealthEndpoint(healthAggregator, healthIndicators); return new HealthEndpoint(healthAggregator, healthIndicators);
} }
@ -131,7 +130,7 @@ public class EndpointAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public InfoEndpoint infoEndpoint() throws Exception { public InfoEndpoint infoEndpoint() throws Exception {
return new InfoEndpoint(this.infoContributors != null ? this.infoContributors return new InfoEndpoint((this.infoContributors != null) ? this.infoContributors
: Collections.<InfoContributor>emptyList()); : Collections.<InfoContributor>emptyList());
} }
@ -156,7 +155,7 @@ public class EndpointAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public TraceEndpoint traceEndpoint() { public TraceEndpoint traceEndpoint() {
return new TraceEndpoint(this.traceRepository != null ? this.traceRepository return new TraceEndpoint((this.traceRepository != null) ? this.traceRepository
: new InMemoryTraceRepository()); : 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -376,8 +376,8 @@ public class EndpointWebMvcAutoConfiguration
} }
return ((managementPort == null) return ((managementPort == null)
|| (serverPort == null && managementPort.equals(8080)) || (serverPort == null && managementPort.equals(8080))
|| (managementPort != 0 && managementPort.equals(serverPort)) ? SAME || (managementPort != 0) && managementPort.equals(serverPort)) ? SAME
: DIFFERENT); : DIFFERENT;
} }
private static <T> T getTemporaryBean(BeanFactory beanFactory, Class<T> type) { private static <T> T getTemporaryBean(BeanFactory beanFactory, Class<T> type) {

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

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

@ -231,7 +231,7 @@ public class HealthIndicatorAutoConfiguration {
private String getValidationQuery(DataSource source) { private String getValidationQuery(DataSource source) {
DataSourcePoolMetadata poolMetadata = this.poolMetadataProvider DataSourcePoolMetadata poolMetadata = this.poolMetadataProvider
.getDataSourcePoolMetadata(source); .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, private void addEndpointLink(ResourceSupport resource, MvcEndpoint endpoint,
String rel) { String rel) {
Class<?> type = endpoint.getEndpointType(); Class<?> type = endpoint.getEndpointType();
type = (type != null ? type : Object.class); type = (type != null) ? type : Object.class;
if (StringUtils.hasText(rel)) { if (StringUtils.hasText(rel)) {
String href = this.rootPath + endpoint.getPath(); String href = this.rootPath + endpoint.getPath();
resource.add(linkTo(type).slash(href).withRel(rel)); resource.add(linkTo(type).slash(href).withRel(rel));

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

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

@ -89,9 +89,9 @@ public class PublicMetricsAutoConfiguration {
@Bean @Bean
public MetricReaderPublicMetrics metricReaderPublicMetrics() { public MetricReaderPublicMetrics metricReaderPublicMetrics() {
MetricReader[] readers = (this.metricReaders != null MetricReader[] readers = (this.metricReaders != null)
? this.metricReaders.toArray(new MetricReader[this.metricReaders.size()]) ? this.metricReaders.toArray(new MetricReader[this.metricReaders.size()])
: new MetricReader[0]); : new MetricReader[0];
return new MetricReaderPublicMetrics(new CompositeMetricReader(readers)); 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 * Base {@link CacheStatisticsProvider} implementation that uses JMX to retrieve the cache
* statistics. * statistics.
* *
* @param <C> The cache type * @param <C> the cache type
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.3.0 * @since 1.3.0
*/ */
@ -56,7 +56,7 @@ public abstract class AbstractJmxCacheStatisticsProvider<C extends Cache>
public CacheStatistics getCacheStatistics(CacheManager cacheManager, C cache) { public CacheStatistics getCacheStatistics(CacheManager cacheManager, C cache) {
try { try {
ObjectName objectName = internalGetObjectName(cache); ObjectName objectName = internalGetObjectName(cache);
return (objectName != null ? getCacheStatistics(objectName) : null); return (objectName != null) ? getCacheStatistics(objectName) : null;
} }
catch (MalformedObjectNameException ex) { catch (MalformedObjectNameException ex) {
throw new IllegalStateException(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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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}. * 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 Stephane Nicoll
* @author Phillip Webb * @author Phillip Webb
* @since 1.3.0 * @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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)) { if (!Double.isNaN(hitRatio)) {
// ratio is calculated 'racily' and can drift marginally above unity, // ratio is calculated 'racily' and can drift marginally above unity,
// so we cap it here // so we cap it here
double sanitizedHitRatio = (hitRatio > 1 ? 1 : hitRatio); double sanitizedHitRatio = (hitRatio > 1) ? 1 : hitRatio;
statistics.setHitRatio(sanitizedHitRatio); statistics.setHitRatio(sanitizedHitRatio);
statistics.setMissRatio(1 - sanitizedHitRatio); statistics.setMissRatio(1 - sanitizedHitRatio);
} }

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

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

@ -84,7 +84,7 @@ public class LoggersEndpoint extends AbstractEndpoint<Map<String, Object>> {
Assert.notNull(name, "Name must not be null"); Assert.notNull(name, "Name must not be null");
LoggerConfiguration configuration = this.loggingSystem LoggerConfiguration configuration = this.loggingSystem
.getLoggerConfiguration(name); .getLoggerConfiguration(name);
return (configuration != null ? new LoggerLevels(configuration) : null); return (configuration != null) ? new LoggerLevels(configuration) : null;
} }
public void setLogLevel(String name, LogLevel level) { public void setLogLevel(String name, LogLevel level) {
@ -107,7 +107,7 @@ public class LoggersEndpoint extends AbstractEndpoint<Map<String, Object>> {
} }
private String getName(LogLevel level) { private String getName(LogLevel level) {
return (level != null ? level.name() : null); return (level != null) ? level.name() : null;
} }
public String getConfiguredLevel() { public String getConfiguredLevel() {

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

@ -115,7 +115,7 @@ public class EndpointMBeanExporter extends MBeanExporter
* @param objectMapper the object mapper * @param objectMapper the object mapper
*/ */
public EndpointMBeanExporter(ObjectMapper objectMapper) { public EndpointMBeanExporter(ObjectMapper objectMapper) {
this.objectMapper = (objectMapper != null ? objectMapper : new ObjectMapper()); this.objectMapper = (objectMapper != null) ? objectMapper : new ObjectMapper();
setAutodetect(false); setAutodetect(false);
setNamingStrategy(this.defaultNamingStrategy); setNamingStrategy(this.defaultNamingStrategy);
setAssembler(this.assembler); setAssembler(this.assembler);
@ -167,8 +167,8 @@ public class EndpointMBeanExporter extends MBeanExporter
for (Map.Entry<String, JmxEndpoint> entry : endpoints.entrySet()) { for (Map.Entry<String, JmxEndpoint> entry : endpoints.entrySet()) {
String name = entry.getKey(); String name = entry.getKey();
JmxEndpoint endpoint = entry.getValue(); JmxEndpoint endpoint = entry.getValue();
Class<?> type = (endpoint.getEndpointType() != null Class<?> type = (endpoint.getEndpointType() != null)
? endpoint.getEndpointType() : endpoint.getClass()); ? endpoint.getEndpointType() : endpoint.getClass();
if (!this.registeredEndpoints.contains(type) && endpoint.isEnabled()) { if (!this.registeredEndpoints.contains(type) && endpoint.isEnabled()) {
try { try {
registerBeanNameOrInstance(endpoint, name); 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 * MVC on the classpath). Note that any endpoints having method signatures will break in a
* non-servlet environment. * non-servlet environment.
* *
* @param <E> The endpoint type * @param <E> the endpoint type
* @author Phillip Webb * @author Phillip Webb
* @author Christian Dupuis * @author Christian Dupuis
* @author Dave Syer * @author Dave Syer
@ -150,7 +150,7 @@ public abstract class AbstractEndpointHandlerMapping<E extends MvcEndpoint>
} }
Assert.state(handler instanceof MvcEndpoint, "Only MvcEndpoints are supported"); Assert.state(handler instanceof MvcEndpoint, "Only MvcEndpoints are supported");
String path = getPath((MvcEndpoint) handler); 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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. * Abstract base class for {@link MvcEndpoint} implementations.
* *
* @param <E> The delegate endpoint * @param <E> the delegate endpoint
* @author Dave Syer * @author Dave Syer
* @author Andy Wilkinson * @author Andy Wilkinson
* @author Phillip Webb * @author Phillip Webb
@ -67,7 +67,7 @@ public abstract class AbstractEndpointMvcAdapter<E extends Endpoint<?>>
@Override @Override
public String getPath() { 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) { 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. * 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 * @since 1.2.4
* @see Endpoint#isEnabled() * @see Endpoint#isEnabled()
*/ */

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

@ -99,7 +99,7 @@ public class OrderedHealthAggregator extends AbstractHealthAggregator {
public int compare(Status s1, Status s2) { public int compare(Status s1, Status s2) {
int i1 = this.statusOrder.indexOf(s1.getCode()); int i1 = this.statusOrder.indexOf(s1.getCode());
int i2 = this.statusOrder.indexOf(s2.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); request.setAction(CoreAdminParams.CoreAdminAction.STATUS);
CoreAdminResponse response = request.process(this.solrClient); CoreAdminResponse response = request.process(this.solrClient);
int statusCode = response.getStatus(); 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", 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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; return this.description;
} }
@Override
public String toString() {
return this.code;
}
@Override
public int hashCode() {
return this.code.hashCode();
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { if (obj == this) {
@ -123,4 +113,14 @@ public final class Status {
return false; 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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; 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. * Create a new {@link Metric} with an incremented value.
* @param amount the amount that the new metric will differ from this one * @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); 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 @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
@ -134,4 +118,20 @@ public class Metric<T extends Number> {
return super.equals(obj); 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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(); StringBuilder builder = new StringBuilder();
for (int i = 0; i < patterns.length; i++) { for (int i = 0; i < patterns.length; i++) {
if ("k".equals(patterns[i])) { if ("k".equals(patterns[i])) {
builder.append(builder.length() > 0 ? "." : ""); builder.append((builder.length() > 0) ? "." : "");
builder.append(keys[i]); builder.append(keys[i]);
} }
} }
for (int i = patterns.length; i < keys.length; i++) { for (int i = patterns.length; i < keys.length; i++) {
builder.append(builder.length() > 0 ? "." : ""); builder.append((builder.length() > 0) ? "." : "");
builder.append(keys[i]); builder.append(keys[i]);
} }
return builder.toString(); return builder.toString();

@ -55,7 +55,7 @@ public class BufferMetricReader implements MetricReader, PrefixMetricReader {
if (buffer == null) { if (buffer == null) {
buffer = this.gaugeBuffers.find(name); buffer = this.gaugeBuffers.find(name);
} }
return (buffer != null ? asMetric(name, buffer) : null); return (buffer != null) ? asMetric(name, buffer) : null;
} }
@Override @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 Dave Syer
* @author Phillip Webb * @author Phillip Webb
* @param <B> The buffer type * @param <B> the buffer type
*/ */
@UsesJava8 @UsesJava8
abstract class Buffers<B extends Buffer<?>> { abstract class Buffers<B extends Buffer<?>> {

@ -80,8 +80,8 @@ public class DropwizardMetricServices implements CounterService, GaugeService {
public DropwizardMetricServices(MetricRegistry registry, public DropwizardMetricServices(MetricRegistry registry,
ReservoirFactory reservoirFactory) { ReservoirFactory reservoirFactory) {
this.registry = registry; this.registry = registry;
this.reservoirFactory = (reservoirFactory != null ? reservoirFactory this.reservoirFactory = (reservoirFactory != null) ? reservoirFactory
: ReservoirFactory.NONE); : ReservoirFactory.NONE;
} }
@Override @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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, "."); String[] parts = StringUtils.delimitedListToStringArray(name, ".");
table.put("type", parts[0]); table.put("type", parts[0]);
if (parts.length > 1) { 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) { if (parts.length > 2) {
table.put("value", 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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, * Return either an exponential weighted moving average or a simple mean,
* respectively, depending on whether the weight 'alpha' has been set for this gauge. * 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() { public double getAverage() {
return this.average; return this.average;

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

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

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

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

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

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

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

@ -232,7 +232,7 @@ public class AutoConfigurationImportSelector
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(getEnvironment(), RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(getEnvironment(),
"spring.autoconfigure."); "spring.autoconfigure.");
String[] exclude = resolver.getProperty("exclude", String[].class); 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, private List<String> sort(List<String> configurations,
@ -298,7 +298,7 @@ public class AutoConfigurationImportSelector
protected final List<String> asList(AnnotationAttributes attributes, String name) { protected final List<String> asList(AnnotationAttributes attributes, String name) {
String[] value = attributes.getStringArray(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, 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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) { static AutoConfigurationMetadata loadMetadata(ClassLoader classLoader, String path) {
try { try {
Enumeration<URL> urls = (classLoader != null ? classLoader.getResources(path) Enumeration<URL> urls = (classLoader != null) ? classLoader.getResources(path)
: ClassLoader.getSystemResources(path)); : ClassLoader.getSystemResources(path);
Properties properties = new Properties(); Properties properties = new Properties();
while (urls.hasMoreElements()) { while (urls.hasMoreElements()) {
properties.putAll(PropertiesLoaderUtils properties.putAll(PropertiesLoaderUtils
@ -89,7 +89,7 @@ final class AutoConfigurationMetadataLoader {
@Override @Override
public Integer getInteger(String className, String key, Integer defaultValue) { public Integer getInteger(String className, String key, Integer defaultValue) {
String value = get(className, key); String value = get(className, key);
return (value != null ? Integer.valueOf(value) : defaultValue); return (value != null) ? Integer.valueOf(value) : defaultValue;
} }
@Override @Override
@ -101,8 +101,8 @@ final class AutoConfigurationMetadataLoader {
public Set<String> getSet(String className, String key, public Set<String> getSet(String className, String key,
Set<String> defaultValue) { Set<String> defaultValue) {
String value = get(className, key); String value = get(className, key);
return (value != null ? StringUtils.commaDelimitedListToSet(value) return (value != null) ? StringUtils.commaDelimitedListToSet(value)
: defaultValue); : defaultValue;
} }
@Override @Override
@ -113,7 +113,7 @@ final class AutoConfigurationMetadataLoader {
@Override @Override
public String get(String className, String key, String defaultValue) { public String get(String className, String key, String defaultValue) {
String value = this.properties.getProperty(className + "." + key); 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()); this.packageName = ClassUtils.getPackageName(metadata.getClassName());
} }
@Override public String getPackageName() {
public int hashCode() { return this.packageName;
return this.packageName.hashCode();
} }
@Override @Override
@ -163,8 +162,9 @@ public abstract class AutoConfigurationPackages {
return this.packageName.equals(((PackageImport) obj).packageName); return this.packageName.equals(((PackageImport) obj).packageName);
} }
public String getPackageName() { @Override
return this.packageName; public int hashCode() {
return this.packageName.hashCode();
} }
@Override @Override

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

@ -111,8 +111,8 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec
for (String annotationName : ANNOTATION_NAMES) { for (String annotationName : ANNOTATION_NAMES) {
AnnotationAttributes merged = AnnotatedElementUtils AnnotationAttributes merged = AnnotatedElementUtils
.getMergedAnnotationAttributes(source, annotationName); .getMergedAnnotationAttributes(source, annotationName);
Class<?>[] exclude = (merged != null ? merged.getClassArray("exclude") Class<?>[] exclude = (merged != null) ? merged.getClassArray("exclude")
: null); : null;
if (exclude != null) { if (exclude != null) {
for (Class<?> excludeClass : exclude) { for (Class<?> excludeClass : exclude) {
exclusions.add(excludeClass.getName()); 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -189,7 +189,7 @@ public class RabbitAutoConfiguration {
private boolean determineMandatoryFlag() { private boolean determineMandatoryFlag() {
Boolean mandatory = this.properties.getTemplate().getMandatory(); 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) { private RetryTemplate createRetryTemplate(RabbitProperties.Retry properties) {

@ -203,7 +203,7 @@ public class RabbitProperties {
return this.username; return this.username;
} }
Address address = this.parsedAddresses.get(0); 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) { public void setUsername(String username) {
@ -226,7 +226,7 @@ public class RabbitProperties {
return getPassword(); return getPassword();
} }
Address address = this.parsedAddresses.get(0); 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) { public void setPassword(String password) {
@ -253,7 +253,7 @@ public class RabbitProperties {
return getVirtualHost(); return getVirtualHost();
} }
Address address = this.parsedAddresses.get(0); 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) { 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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.maxAttempts(retryConfig.getMaxAttempts());
builder.backOffOptions(retryConfig.getInitialInterval(), builder.backOffOptions(retryConfig.getInitialInterval(),
retryConfig.getMultiplier(), retryConfig.getMaxInterval()); retryConfig.getMultiplier(), retryConfig.getMaxInterval());
MessageRecoverer recoverer = (this.messageRecoverer != null MessageRecoverer recoverer = (this.messageRecoverer != null)
? this.messageRecoverer : new RejectAndDontRequeueRecoverer()); ? this.messageRecoverer : new RejectAndDontRequeueRecoverer();
builder.recoverer(recoverer); builder.recoverer(recoverer);
factory.setAdviceChain(builder.build()); 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -41,9 +41,9 @@ public class CacheManagerCustomizers {
public CacheManagerCustomizers( public CacheManagerCustomizers(
List<? extends CacheManagerCustomizer<?>> customizers) { List<? extends CacheManagerCustomizer<?>> customizers) {
this.customizers = (customizers != null this.customizers = (customizers != null)
? new ArrayList<CacheManagerCustomizer<?>>(customizers) ? 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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) { private List<String[]> getConditionClasses(AnnotatedTypeMetadata metadata) {
MultiValueMap<String, Object> attributes = metadata MultiValueMap<String, Object> attributes = metadata
.getAllAnnotationAttributes(Conditional.class.getName(), true); .getAllAnnotationAttributes(Conditional.class.getName(), true);
Object values = (attributes != null ? attributes.get("value") : null); Object values = (attributes != null) ? attributes.get("value") : null;
return (List<String[]>) (values != null ? values : Collections.emptyList()); return (List<String[]>) ((values != null) ? values : Collections.emptyList());
} }
private Condition getCondition(String conditionClassName) { 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -46,8 +46,8 @@ class ConditionEvaluationReportAutoConfigurationImportListener
@Override @Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException { public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = (beanFactory instanceof ConfigurableListableBeanFactory this.beanFactory = (beanFactory instanceof ConfigurableListableBeanFactory)
? (ConfigurableListableBeanFactory) beanFactory : null); ? (ConfigurableListableBeanFactory) beanFactory : null;
} }
} }

@ -59,16 +59,6 @@ public final class ConditionMessage {
return !StringUtils.hasLength(this.message); 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 @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || !ConditionMessage.class.isInstance(obj)) { if (obj == null || !ConditionMessage.class.isInstance(obj)) {
@ -80,6 +70,16 @@ public final class ConditionMessage {
return ObjectUtils.nullSafeEquals(((ConditionMessage) obj).message, this.message); 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 * Return a new {@link ConditionMessage} based on the instance and an appended
* message. * message.
@ -359,7 +359,7 @@ public final class ConditionMessage {
*/ */
public ConditionMessage items(Style style, Object... items) { public ConditionMessage items(Style style, Object... items) {
return items(style, 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 { QUOTE {
@Override @Override
protected String applyToItem(Object item) { 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; return this.message;
} }
@Override
public int hashCode() {
return ObjectUtils.hashCode(this.match) * 31
+ ObjectUtils.nullSafeHashCode(this.message);
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
@ -144,9 +138,15 @@ public class ConditionOutcome {
return super.equals(obj); return super.equals(obj);
} }
@Override
public int hashCode() {
return ObjectUtils.hashCode(this.match) * 31
+ ObjectUtils.nullSafeHashCode(this.message);
}
@Override @Override
public String toString() { 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() { public SearchStrategy getStrategy() {
return (this.strategy != null ? this.strategy : SearchStrategy.ALL); return (this.strategy != null) ? this.strategy : SearchStrategy.ALL;
} }
public List<String> getNames() { public List<String> getNames() {

@ -53,7 +53,7 @@ class OnJavaCondition extends SpringBootCondition {
JavaVersion version) { JavaVersion version) {
boolean match = runningVersion.isWithin(range, version); boolean match = runningVersion.isWithin(range, version);
String expected = String.format( 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); version);
ConditionMessage message = ConditionMessage ConditionMessage message = ConditionMessage
.forCondition(ConditionalOnJava.class, expected) .forCondition(ConditionalOnJava.class, expected)

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

@ -46,8 +46,8 @@ class OnResourceCondition extends SpringBootCondition {
AnnotatedTypeMetadata metadata) { AnnotatedTypeMetadata metadata) {
MultiValueMap<String, Object> attributes = metadata MultiValueMap<String, Object> attributes = metadata
.getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true); .getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true);
ResourceLoader loader = (context.getResourceLoader() != null ResourceLoader loader = (context.getResourceLoader() != null)
? context.getResourceLoader() : this.defaultResourceLoader); ? context.getResourceLoader() : this.defaultResourceLoader;
List<String> locations = new ArrayList<String>(); List<String> locations = new ArrayList<String>();
collectValues(locations, attributes.get("resources")); collectValues(locations, attributes.get("resources"));
Assert.isTrue(!locations.isEmpty(), 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -174,8 +174,8 @@ public class CouchbaseProperties {
private String keyStorePassword; private String keyStorePassword;
public Boolean getEnabled() { public Boolean getEnabled() {
return (this.enabled != null ? this.enabled return (this.enabled != null) ? this.enabled
: StringUtils.hasText(this.keyStore)); : StringUtils.hasText(this.keyStore);
} }
public void setEnabled(Boolean enabled) { 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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, RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
"spring.aop."); "spring.aop.");
Boolean value = resolver.getProperty("proxyTargetClass", Boolean.class); 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() { private JedisConnectionFactory createJedisConnectionFactory() {
JedisPoolConfig poolConfig = (this.properties.getPool() != null JedisPoolConfig poolConfig = (this.properties.getPool() != null)
? jedisPoolConfig() : new JedisPoolConfig()); ? jedisPoolConfig() : new JedisPoolConfig();
if (getSentinelConfig() != null) { if (getSentinelConfig() != null) {
return new JedisConnectionFactory(getSentinelConfig(), poolConfig); return new JedisConnectionFactory(getSentinelConfig(), poolConfig);
} }

@ -80,7 +80,7 @@ class NoSuchBeanDefinitionFailureAnalyzer
cause); cause);
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
message.append(String.format("%s required %s that could not be found.%n", 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))); getBeanDescription(cause)));
if (!autoConfigurationResults.isEmpty()) { if (!autoConfigurationResults.isEmpty()) {
for (AutoConfigurationResult provider : autoConfigurationResults) { for (AutoConfigurationResult provider : autoConfigurationResults) {
@ -164,8 +164,8 @@ class NoSuchBeanDefinitionFailureAnalyzer
Source(String source) { Source(String source) {
String[] tokens = source.split("#"); String[] tokens = source.split("#");
this.className = (tokens.length > 1 ? tokens[0] : source); this.className = (tokens.length > 1) ? tokens[0] : source;
this.methodName = (tokens.length != 2 ? null : tokens[1]); this.methodName = (tokens.length != 2) ? null : tokens[1];
} }
public String getClassName() { public String getClassName() {
@ -225,8 +225,8 @@ class NoSuchBeanDefinitionFailureAnalyzer
private boolean hasName(MethodMetadata methodMetadata, String name) { private boolean hasName(MethodMetadata methodMetadata, String name) {
Map<String, Object> attributes = methodMetadata Map<String, Object> attributes = methodMetadata
.getAnnotationAttributes(Bean.class.getName()); .getAnnotationAttributes(Bean.class.getName());
String[] candidates = (attributes != null ? (String[]) attributes.get("name") String[] candidates = (attributes != null) ? (String[]) attributes.get("name")
: null); : null;
if (candidates != null) { if (candidates != null) {
for (String candidate : candidates) { for (String candidate : candidates) {
if (candidate.equals(name)) { if (candidate.equals(name)) {

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

@ -184,7 +184,7 @@ public class DataSourceAutoConfiguration {
private ClassLoader getDataSourceClassLoader(ConditionContext context) { private ClassLoader getDataSourceClassLoader(ConditionContext context) {
Class<?> dataSourceClass = new DataSourceBuilder(context.getClassLoader()) Class<?> dataSourceClass = new DataSourceBuilder(context.getClassLoader())
.findType(); .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) { public String getUrl(String databaseName) {
Assert.hasText(databaseName, "DatabaseName must not be null."); 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( public DataSourcePoolMetadataProviders(
Collection<? extends DataSourcePoolMetadataProvider> providers) { Collection<? extends DataSourcePoolMetadataProvider> providers) {
this.providers = (providers != null this.providers = (providers != null)
? new ArrayList<DataSourcePoolMetadataProvider>(providers) ? new ArrayList<DataSourcePoolMetadataProvider>(providers)
: Collections.<DataSourcePoolMetadataProvider>emptyList()); : Collections.<DataSourcePoolMetadataProvider>emptyList();
} }
@Override @Override

@ -34,7 +34,7 @@ public class TomcatDataSourcePoolMetadata
@Override @Override
public Integer getActive() { public Integer getActive() {
ConnectionPool pool = getDataSource().getPool(); ConnectionPool pool = getDataSource().getPool();
return (pool != null ? pool.getActive() : 0); return (pool != null) ? pool.getActive() : 0;
} }
@Override @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -124,11 +124,11 @@ public class JmsProperties {
public String formatConcurrency() { public String formatConcurrency() {
if (this.concurrency == null) { 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 ? this.concurrency + "-" + this.maxConcurrency
: String.valueOf(this.concurrency)); : String.valueOf(this.concurrency);
} }
} }

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

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

@ -128,13 +128,13 @@ public class EmbeddedMongoAutoConfiguration {
this.embeddedProperties.getFeatures()); this.embeddedProperties.getFeatures());
MongodConfigBuilder builder = new MongodConfigBuilder() MongodConfigBuilder builder = new MongodConfigBuilder()
.version(featureAwareVersion); .version(featureAwareVersion);
if (this.embeddedProperties.getStorage() != null) { org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoProperties.Storage storage = this.embeddedProperties
builder.replication( .getStorage();
new Storage(this.embeddedProperties.getStorage().getDatabaseDir(), if (storage != null) {
this.embeddedProperties.getStorage().getReplSetName(), String databaseDir = storage.getDatabaseDir();
this.embeddedProperties.getStorage().getOplogSize() != null String replSetName = storage.getReplSetName();
? this.embeddedProperties.getStorage().getOplogSize() int oplogSize = (storage.getOplogSize() != null) ? storage.getOplogSize() : 0;
: 0)); builder.replication(new Storage(databaseDir, replSetName, oplogSize));
} }
Integer configuredPort = this.properties.getPort(); Integer configuredPort = this.properties.getPort();
if (configuredPort != null && configuredPort > 0) { if (configuredPort != null && configuredPort > 0) {
@ -239,8 +239,8 @@ public class EmbeddedMongoAutoConfiguration {
Set<Feature> features) { Set<Feature> features) {
Assert.notNull(version, "version must not be null"); Assert.notNull(version, "version must not be null");
this.version = version; this.version = version;
this.features = (features != null ? features this.features = (features != null) ? features
: Collections.<Feature>emptySet()); : Collections.<Feature>emptySet();
} }
@Override @Override
@ -253,20 +253,6 @@ public class EmbeddedMongoAutoConfiguration {
return this.features.contains(feature); 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 @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
@ -285,6 +271,20 @@ public class EmbeddedMongoAutoConfiguration {
return super.equals(obj); 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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) { private DataSource findDataSource(EntityManagerFactory entityManagerFactory) {
Object dataSource = entityManagerFactory.getProperties() Object dataSource = entityManagerFactory.getProperties()
.get("javax.persistence.nonJtaDataSource"); .get("javax.persistence.nonJtaDataSource");
return (dataSource != null && dataSource instanceof DataSource return (dataSource != null && dataSource instanceof DataSource)
? (DataSource) dataSource : this.dataSource); ? (DataSource) dataSource : this.dataSource;
} }
private boolean isInitializingDatabase(DataSource 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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, private String getOrDeduceDdlAuto(Map<String, String> existing,
DataSource dataSource) { DataSource dataSource) {
String ddlAuto = (this.ddlAuto != null ? this.ddlAuto String ddlAuto = (this.ddlAuto != null) ? this.ddlAuto
: getDefaultDdlAuto(dataSource)); : getDefaultDdlAuto(dataSource);
if (!existing.containsKey("hibernate." + "hbm2ddl.auto") if (!existing.containsKey("hibernate." + "hbm2ddl.auto")
&& !"none".equals(ddlAuto)) { && !"none".equals(ddlAuto)) {
return ddlAuto; return ddlAuto;

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

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

@ -115,7 +115,7 @@ public class UserInfoTokenServices implements ResourceServerTokenServices {
*/ */
protected Object getPrincipal(Map<String, Object> map) { protected Object getPrincipal(Map<String, Object> map) {
Object principal = this.principalExtractor.extractPrincipal(map); Object principal = this.principalExtractor.extractPrincipal(map);
return (principal != null ? principal : "unknown"); return (principal != null) ? principal : "unknown";
} }
@Override @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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) { public SessionProperties(ObjectProvider<ServerProperties> serverProperties) {
ServerProperties properties = serverProperties.getIfUnique(); ServerProperties properties = serverProperties.getIfUnique();
this.timeout = (properties != null ? properties.getSession().getTimeout() : null); this.timeout = (properties != null) ? properties.getSession().getTimeout() : null;
} }
public StoreType getStoreType() { public StoreType getStoreType() {

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

@ -70,7 +70,7 @@ public class LinkedInAutoConfiguration {
public LinkedIn linkedin(ConnectionRepository repository) { public LinkedIn linkedin(ConnectionRepository repository) {
Connection<LinkedIn> connection = repository Connection<LinkedIn> connection = repository
.findPrimaryConnection(LinkedIn.class); .findPrimaryConnection(LinkedIn.class);
return (connection != null ? connection.getApi() : null); return (connection != null) ? connection.getApi() : null;
} }
@Bean(name = { "connect/linkedinConnect", "connect/linkedinConnected" }) @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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() { public String getCharsetName() {
return (this.charset != null ? this.charset.name() : null); return (this.charset != null) ? this.charset.name() : null;
} }
public void setCharset(Charset charset) { public void setCharset(Charset charset) {

@ -76,7 +76,7 @@ public class TemplateAvailabilityProviders {
* @param applicationContext the source application context * @param applicationContext the source application context
*/ */
public TemplateAvailabilityProviders(ApplicationContext applicationContext) { 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) { if (provider == null) {
synchronized (this.cache) { synchronized (this.cache) {
provider = findProvider(view, environment, classLoader, resourceLoader); provider = findProvider(view, environment, classLoader, resourceLoader);
provider = (provider != null ? provider : NONE); provider = (provider != null) ? provider : NONE;
this.resolved.put(view, provider); this.resolved.put(view, provider);
this.cache.put(view, provider); this.cache.put(view, provider);
} }
} }
return (provider != NONE ? provider : null); return (provider != NONE) ? provider : null;
} }
private TemplateAvailabilityProvider findProvider(String view, 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * {@link PlatformTransactionManager PlatformTransactionManagers} whilst retaining default
* auto-configuration. * auto-configuration.
* *
* @param <T> The transaction manager type * @param <T> the transaction manager type
* @author Phillip Webb * @author Phillip Webb
* @since 1.5.0 * @since 1.5.0
*/ */

@ -41,9 +41,9 @@ public class TransactionManagerCustomizers {
public TransactionManagerCustomizers( public TransactionManagerCustomizers(
Collection<? extends PlatformTransactionManagerCustomizer<?>> customizers) { Collection<? extends PlatformTransactionManagerCustomizer<?>> customizers) {
this.customizers = (customizers != null this.customizers = (customizers != null)
? new ArrayList<PlatformTransactionManagerCustomizer<?>>(customizers) ? new ArrayList<PlatformTransactionManagerCustomizer<?>>(customizers)
: null); : null;
} }
public void customize(PlatformTransactionManager transactionManager) { 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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, RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
"spring.aop."); "spring.aop.");
Boolean value = resolver.getProperty("proxyTargetClass", Boolean.class); 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))); request, isIncludeStackTrace(request, MediaType.TEXT_HTML)));
response.setStatus(status.value()); response.setStatus(status.value());
ModelAndView modelAndView = resolveErrorView(request, response, status, model); ModelAndView modelAndView = resolveErrorView(request, response, status, model);
return (modelAndView != null ? modelAndView : new ModelAndView("error", model)); return (modelAndView != null) ? modelAndView : new ModelAndView("error", model);
} }
@RequestMapping @RequestMapping

@ -283,11 +283,12 @@ public class ErrorMvcAutoConfiguration {
@Override @Override
public String resolvePlaceholder(String placeholderName) { public String resolvePlaceholder(String placeholderName) {
Expression expression = this.expressions.get(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) { 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 shouldForce(Type type) {
Boolean force = (type != Type.REQUEST ? this.forceResponse : this.forceRequest); Boolean force = (type != Type.REQUEST) ? this.forceResponse : this.forceRequest;
if (force == null) { if (force == null) {
force = this.force; force = this.force;
} }

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

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

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

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

@ -96,8 +96,8 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
private List<String> getEntityManagerFactoryDependencies() { private List<String> getEntityManagerFactoryDependencies() {
String[] dependsOn = this.context.getBeanDefinition("entityManagerFactory") String[] dependsOn = this.context.getBeanDefinition("entityManagerFactory")
.getDependsOn(); .getDependsOn();
return (dependsOn != null ? Arrays.asList(dependsOn) return (dependsOn != null) ? Arrays.asList(dependsOn)
: Collections.<String>emptyList()); : Collections.<String>emptyList();
} }
public void load(Class<?> config) { 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * Launches the application created using the given {@code sources}. The application
* is launched with the given {@code args}. * is launched with the given {@code args}.
* @param sources The sources for the application * @param sources the sources for the application
* @param args The args for the application * @param args the args for the application
* @return The application's {@code ApplicationContext} * @return the application's {@code ApplicationContext}
* @throws Exception if the launch fails * @throws Exception if the launch fails
*/ */
public Object launch(Object[] sources, String[] args) throws Exception { public Object launch(Object[] sources, String[] args) throws Exception {

@ -64,7 +64,7 @@ public class SpringApplicationWebApplicationInitializer
private Manifest getManifest(ServletContext servletContext) throws IOException { private Manifest getManifest(ServletContext servletContext) throws IOException {
InputStream stream = servletContext.getResourceAsStream("/META-INF/MANIFEST.MF"); 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; 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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. * Returns the CLI {@link Command}s.
* @return The commands * @return the commands
*/ */
Collection<Command> getCommands(); Collection<Command> getCommands();

@ -171,7 +171,7 @@ public class CommandRunner implements Iterable<Command> {
ExitStatus result = run(argsWithoutDebugFlags); ExitStatus result = run(argsWithoutDebugFlags);
// The caller will hang up if it gets a non-zero status // The caller will hang up if it gets a non-zero status
if (result != null && result.isHangup()) { if (result != null && result.isHangup()) {
return (result.getCode() > 0 ? result.getCode() : 0); return (result.getCode() > 0) ? result.getCode() : 0;
} }
return 0; return 0;
} }
@ -260,7 +260,7 @@ public class CommandRunner implements Iterable<Command> {
} }
protected boolean errorMessage(String message) { protected boolean errorMessage(String message) {
Log.error(message != null ? message : "Unexpected error"); Log.error((message != null) ? message : "Unexpected error");
return message != null; return message != null;
} }
@ -280,8 +280,8 @@ public class CommandRunner implements Iterable<Command> {
String usageHelp = command.getUsageHelp(); String usageHelp = command.getUsageHelp();
String description = command.getDescription(); String description = command.getDescription();
Log.info(String.format("%n %1$s %2$-15s%n %3$s", command.getName(), Log.info(String.format("%n %1$s %2$-15s%n %3$s", command.getName(),
(usageHelp != null ? usageHelp : ""), (usageHelp != null) ? usageHelp : "",
(description != null ? description : ""))); (description != null) ? description : ""));
} }
} }
Log.info(""); 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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. * 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 * @param example the example
*/ */
public HelpExample(String description, String example) { public HelpExample(String description, String example) {

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

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

@ -45,7 +45,7 @@ public class HintCommand extends AbstractCommand {
@Override @Override
public ExitStatus run(String... args) throws Exception { public ExitStatus run(String... args) throws Exception {
try { 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); List<String> arguments = new ArrayList<String>(args.length);
for (int i = 2; i < args.length; i++) { for (int i = 2; i < args.length; i++) {
arguments.add(args[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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 { private String getContent(HttpEntity entity) throws IOException {
ContentType contentType = ContentType.getOrDefault(entity); ContentType contentType = ContentType.getOrDefault(entity);
Charset charset = contentType.getCharset(); Charset charset = contentType.getCharset();
charset = (charset != null ? charset : UTF_8); charset = (charset != null) ? charset : UTF_8;
byte[] content = FileCopyUtils.copyToByteArray(entity.getContent()); byte[] content = FileCopyUtils.copyToByteArray(entity.getContent());
return new String(content, charset); return new String(content, charset);
} }

@ -418,7 +418,7 @@ class ProjectGenerationRequest {
} }
if (this.output != null) { if (this.output != null) {
int i = this.output.lastIndexOf('.'); 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; return null;
} }

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

Loading…
Cancel
Save