Upgrade to spring-javaformat 0.0.6

This commit is contained in:
Phillip Webb
2018-08-28 15:22:36 -07:00
parent 17de1571f5
commit 9543fcf44d
290 changed files with 1021 additions and 1014 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,9 +56,9 @@ public class AuditEvent implements Serializable {
/**
* Create a new audit event for the current time.
* @param principal The user principal responsible
* @param principal the user principal responsible
* @param type the event type
* @param data The event data
* @param data the event data
*/
public AuditEvent(String principal, String type, Map<String, Object> data) {
this(new Date(), principal, type, data);
@@ -67,9 +67,9 @@ public class AuditEvent implements Serializable {
/**
* Create a new audit event for the current time from data provided as name-value
* pairs.
* @param principal The user principal responsible
* @param principal the user principal responsible
* @param type the event type
* @param data The event data in the form 'key=value' or simply 'key'
* @param data the event data in the form 'key=value' or simply 'key'
*/
public AuditEvent(String principal, String type, String... data) {
this(new Date(), principal, type, convert(data));
@@ -77,17 +77,17 @@ public class AuditEvent implements Serializable {
/**
* Create a new audit event.
* @param timestamp The date/time of the event
* @param principal The user principal responsible
* @param timestamp the date/time of the event
* @param principal the user principal responsible
* @param type the event type
* @param data The event data
* @param data the event data
*/
public AuditEvent(Date timestamp, String principal, String type,
Map<String, Object> data) {
Assert.notNull(timestamp, "Timestamp must not be null");
Assert.notNull(type, "Type must not be null");
this.timestamp = timestamp;
this.principal = (principal != null ? principal : "");
this.principal = (principal != null) ? principal : "";
this.type = type;
this.data = Collections.unmodifiableMap(data);
}

View File

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

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -376,8 +376,8 @@ public class EndpointWebMvcAutoConfiguration
}
return ((managementPort == null)
|| (serverPort == null && managementPort.equals(8080))
|| (managementPort != 0 && managementPort.equals(serverPort)) ? SAME
: DIFFERENT);
|| (managementPort != 0) && managementPort.equals(serverPort)) ? SAME
: DIFFERENT;
}
private static <T> T getTemporaryBean(BeanFactory beanFactory, Class<T> type) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ import org.springframework.cache.CacheManager;
/**
* Provide a {@link CacheStatistics} based on a {@link Cache}.
*
* @param <C> The {@link Cache} type
* @param <C> the {@link Cache} type
* @author Stephane Nicoll
* @author Phillip Webb
* @since 1.3.0

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ public class EhCacheStatisticsProvider implements CacheStatisticsProvider<EhCach
if (!Double.isNaN(hitRatio)) {
// ratio is calculated 'racily' and can drift marginally above unity,
// so we cap it here
double sanitizedHitRatio = (hitRatio > 1 ? 1 : hitRatio);
double sanitizedHitRatio = (hitRatio > 1) ? 1 : hitRatio;
statistics.setHitRatio(sanitizedHitRatio);
statistics.setMissRatio(1 - sanitizedHitRatio);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import org.springframework.util.Assert;
/**
* Abstract base class for {@link MvcEndpoint} implementations.
*
* @param <E> The delegate endpoint
* @param <E> the delegate endpoint
* @author Dave Syer
* @author Andy Wilkinson
* @author Phillip Webb
@@ -67,7 +67,7 @@ public abstract class AbstractEndpointMvcAdapter<E extends Endpoint<?>>
@Override
public String getPath() {
return (this.path != null ? this.path : "/" + this.delegate.getId());
return (this.path != null) ? this.path : "/" + this.delegate.getId();
}
public void setPath(String path) {
@@ -93,7 +93,7 @@ public abstract class AbstractEndpointMvcAdapter<E extends Endpoint<?>>
/**
* Returns the response that should be returned when the endpoint is disabled.
* @return The response to be returned when the endpoint is disabled
* @return the response to be returned when the endpoint is disabled
* @since 1.2.4
* @see Endpoint#isEnabled()
*/

View File

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

View File

@@ -99,7 +99,7 @@ public class OrderedHealthAggregator extends AbstractHealthAggregator {
public int compare(Status s1, Status s2) {
int i1 = this.statusOrder.indexOf(s1.getCode());
int i2 = this.statusOrder.indexOf(s2.getCode());
return (i1 < i2 ? -1 : (i1 != i2 ? 1 : s1.getCode().compareTo(s2.getCode())));
return (i1 < i2) ? -1 : (i1 != i2) ? 1 : s1.getCode().compareTo(s2.getCode());
}
}

View File

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

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -102,16 +102,6 @@ public final class Status {
return this.description;
}
@Override
public String toString() {
return this.code;
}
@Override
public int hashCode() {
return this.code.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@@ -123,4 +113,14 @@ public final class Status {
return false;
}
@Override
public int hashCode() {
return this.code.hashCode();
}
@Override
public String toString() {
return this.code;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,12 +79,6 @@ public class Metric<T extends Number> {
return this.timestamp;
}
@Override
public String toString() {
return "Metric [name=" + this.name + ", value=" + this.value + ", timestamp="
+ this.timestamp + "]";
}
/**
* Create a new {@link Metric} with an incremented value.
* @param amount the amount that the new metric will differ from this one
@@ -105,16 +99,6 @@ public class Metric<T extends Number> {
return new Metric<S>(this.getName(), value);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ObjectUtils.nullSafeHashCode(this.name);
result = prime * result + ObjectUtils.nullSafeHashCode(this.timestamp);
result = prime * result + ObjectUtils.nullSafeHashCode(this.value);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -134,4 +118,20 @@ public class Metric<T extends Number> {
return super.equals(obj);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ObjectUtils.nullSafeHashCode(this.name);
result = prime * result + ObjectUtils.nullSafeHashCode(this.timestamp);
result = prime * result + ObjectUtils.nullSafeHashCode(this.value);
return result;
}
@Override
public String toString() {
return "Metric [name=" + this.name + ", value=" + this.value + ", timestamp="
+ this.timestamp + "]";
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -144,12 +144,12 @@ public class AggregateMetricReader implements MetricReader {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < patterns.length; i++) {
if ("k".equals(patterns[i])) {
builder.append(builder.length() > 0 ? "." : "");
builder.append((builder.length() > 0) ? "." : "");
builder.append(keys[i]);
}
}
for (int i = patterns.length; i < keys.length; i++) {
builder.append(builder.length() > 0 ? "." : "");
builder.append((builder.length() > 0) ? "." : "");
builder.append(keys[i]);
}
return builder.toString();

View File

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

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ import org.springframework.lang.UsesJava8;
*
* @author Dave Syer
* @author Phillip Webb
* @param <B> The buffer type
* @param <B> the buffer type
*/
@UsesJava8
abstract class Buffers<B extends Buffer<?>> {

View File

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

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@ public class DefaultMetricNamingStrategy implements ObjectNamingStrategy {
String[] parts = StringUtils.delimitedListToStringArray(name, ".");
table.put("type", parts[0]);
if (parts.length > 1) {
table.put(parts.length > 2 ? "name" : "value", parts[1]);
table.put((parts.length > 2) ? "name" : "value", parts[1]);
}
if (parts.length > 2) {
table.put("value",

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -126,7 +126,7 @@ public final class RichGauge {
/**
* Return either an exponential weighted moving average or a simple mean,
* respectively, depending on whether the weight 'alpha' has been set for this gauge.
* @return The average over all the accumulated values
* @return the average over all the accumulated values
*/
public double getAverage() {
return this.average;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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