Fix checkstyle ternary issues
Fix checkstyle issues with ternary expressions following the spring-javaformat upgrade. See gh-13932
This commit is contained in:
parent
ec1100a896
commit
7fc455654a
|
@ -72,7 +72,7 @@ public class CloudFoundryWebEndpointDiscoverer extends WebEndpointDiscoverer {
|
|||
AnnotationAttributes attributes = AnnotatedElementUtils
|
||||
.getMergedAnnotationAttributes(extensionBean.getClass(),
|
||||
EndpointWebExtension.class);
|
||||
Class<?> endpoint = (attributes != null ? attributes.getClass("endpoint") : null);
|
||||
Class<?> endpoint = (attributes != null) ? attributes.getClass("endpoint") : null;
|
||||
return (endpoint != null && HealthEndpoint.class.isAssignableFrom(endpoint));
|
||||
}
|
||||
|
||||
|
|
|
@ -126,8 +126,8 @@ public class ReactiveCloudFoundryActuatorAutoConfiguration {
|
|||
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
|
||||
boolean skipSslValidation = environment.getProperty(
|
||||
"management.cloudfoundry.skip-ssl-validation", Boolean.class, false);
|
||||
return (cloudControllerUrl != null ? new ReactiveCloudFoundrySecurityService(
|
||||
webClientBuilder, cloudControllerUrl, skipSslValidation) : null);
|
||||
return (cloudControllerUrl != null) ? new ReactiveCloudFoundrySecurityService(
|
||||
webClientBuilder, cloudControllerUrl, skipSslValidation) : null;
|
||||
}
|
||||
|
||||
private CorsConfiguration getCorsConfiguration() {
|
||||
|
|
|
@ -130,8 +130,8 @@ public class CloudFoundryActuatorAutoConfiguration {
|
|||
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
|
||||
boolean skipSslValidation = environment.getProperty(
|
||||
"management.cloudfoundry.skip-ssl-validation", Boolean.class, false);
|
||||
return (cloudControllerUrl != null ? new CloudFoundrySecurityService(
|
||||
restTemplateBuilder, cloudControllerUrl, skipSslValidation) : null);
|
||||
return (cloudControllerUrl != null) ? new CloudFoundrySecurityService(
|
||||
restTemplateBuilder, cloudControllerUrl, skipSslValidation) : null;
|
||||
}
|
||||
|
||||
private CorsConfiguration getCorsConfiguration() {
|
||||
|
|
|
@ -125,8 +125,8 @@ public class ConditionsReportEndpoint {
|
|||
this.unconditionalClasses = report.getUnconditionalClasses();
|
||||
report.getConditionAndOutcomesBySource().forEach(
|
||||
(source, conditionAndOutcomes) -> add(source, conditionAndOutcomes));
|
||||
this.parentId = (context.getParent() != null ? context.getParent().getId()
|
||||
: null);
|
||||
this.parentId = (context.getParent() != null) ? context.getParent().getId()
|
||||
: null;
|
||||
}
|
||||
|
||||
private void add(String source, ConditionAndOutcomes conditionAndOutcomes) {
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ElasticsearchHealthIndicatorAutoConfiguration {
|
|||
protected ElasticsearchHealthIndicator createHealthIndicator(Client client) {
|
||||
Duration responseTimeout = this.properties.getResponseTimeout();
|
||||
return new ElasticsearchHealthIndicator(client,
|
||||
responseTimeout != null ? responseTimeout.toMillis() : 100,
|
||||
(responseTimeout != null) ? responseTimeout.toMillis() : 100,
|
||||
this.properties.getIndices());
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public class DataSourceHealthIndicatorAutoConfiguration extends
|
|||
private String getValidationQuery(DataSource source) {
|
||||
DataSourcePoolMetadata poolMetadata = this.poolMetadataProvider
|
||||
.getDataSourcePoolMetadata(source);
|
||||
return (poolMetadata != null ? poolMetadata.getValidationQuery() : null);
|
||||
return (poolMetadata != null) ? poolMetadata.getValidationQuery() : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,9 +51,9 @@ class MeterRegistryConfigurer {
|
|||
Collection<MeterFilter> filters,
|
||||
Collection<MeterRegistryCustomizer<?>> customizers,
|
||||
boolean addToGlobalRegistry) {
|
||||
this.binders = (binders != null ? binders : Collections.emptyList());
|
||||
this.filters = (filters != null ? filters : Collections.emptyList());
|
||||
this.customizers = (customizers != null ? customizers : Collections.emptyList());
|
||||
this.binders = (binders != null) ? binders : Collections.emptyList();
|
||||
this.filters = (filters != null) ? filters : Collections.emptyList();
|
||||
this.customizers = (customizers != null) ? customizers : Collections.emptyList();
|
||||
this.addToGlobalRegistry = addToGlobalRegistry;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,10 +67,10 @@ public class PropertiesMeterFilter implements MeterFilter {
|
|||
}
|
||||
|
||||
private long[] convertSla(Meter.Type meterType, ServiceLevelAgreementBoundary[] sla) {
|
||||
long[] converted = Arrays.stream(sla != null ? sla : EMPTY_SLA)
|
||||
long[] converted = Arrays.stream((sla != null) ? sla : EMPTY_SLA)
|
||||
.map((candidate) -> candidate.getValue(meterType))
|
||||
.filter(Objects::nonNull).mapToLong(Long::longValue).toArray();
|
||||
return (converted.length != 0 ? converted : null);
|
||||
return (converted.length != 0) ? converted : null;
|
||||
}
|
||||
|
||||
private <T> T lookup(Map<String, T> values, Id id, T defaultValue) {
|
||||
|
@ -84,7 +84,7 @@ public class PropertiesMeterFilter implements MeterFilter {
|
|||
return result;
|
||||
}
|
||||
int lastDot = name.lastIndexOf('.');
|
||||
name = (lastDot != -1 ? name.substring(0, lastDot) : "");
|
||||
name = (lastDot != -1) ? name.substring(0, lastDot) : "";
|
||||
}
|
||||
return values.getOrDefault("all", defaultValue);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class PropertiesConfigAdapter<T> {
|
|||
*/
|
||||
protected final <V> V get(Function<T, V> getter, Supplier<V> fallback) {
|
||||
V value = getter.apply(this.properties);
|
||||
return (value != null ? value : fallback.get());
|
||||
return (value != null) ? value : fallback.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class WavefrontPropertiesConfigAdapter
|
|||
}
|
||||
|
||||
private String getUriAsString(WavefrontProperties properties) {
|
||||
return (properties.getUri() != null ? properties.getUri().toString() : null);
|
||||
return (properties.getUri() != null) ? properties.getUri().toString() : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,8 @@ public class TomcatMetricsAutoConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public TomcatMetrics tomcatMetrics() {
|
||||
return new TomcatMetrics(this.context != null ? this.context.getManager() : null,
|
||||
return new TomcatMetrics(
|
||||
(this.context != null) ? this.context.getManager() : null,
|
||||
Collections.emptyList());
|
||||
}
|
||||
|
||||
|
|
|
@ -125,17 +125,17 @@ class ManagementContextConfigurationImportSelector
|
|||
Map<String, Object> annotationAttributes = annotationMetadata
|
||||
.getAnnotationAttributes(
|
||||
ManagementContextConfiguration.class.getName());
|
||||
return (annotationAttributes != null
|
||||
return (annotationAttributes != null)
|
||||
? (ManagementContextType) annotationAttributes.get("value")
|
||||
: ManagementContextType.ANY);
|
||||
: ManagementContextType.ANY;
|
||||
}
|
||||
|
||||
private int readOrder(AnnotationMetadata annotationMetadata) {
|
||||
Map<String, Object> attributes = annotationMetadata
|
||||
.getAnnotationAttributes(Order.class.getName());
|
||||
Integer order = (attributes != null ? (Integer) attributes.get("value")
|
||||
: null);
|
||||
return (order != null ? order : Ordered.LOWEST_PRECEDENCE);
|
||||
Integer order = (attributes != null) ? (Integer) attributes.get("value")
|
||||
: null;
|
||||
return (order != null) ? order : Ordered.LOWEST_PRECEDENCE;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -47,9 +47,9 @@ public enum ManagementPortType {
|
|||
if (managementPort != null && managementPort < 0) {
|
||||
return DISABLED;
|
||||
}
|
||||
return ((managementPort == null)
|
||||
return ((managementPort == null
|
||||
|| (serverPort == null && managementPort.equals(8080))
|
||||
|| (managementPort != 0 && managementPort.equals(serverPort)) ? SAME
|
||||
|| (managementPort != 0 && managementPort.equals(serverPort))) ? SAME
|
||||
: DIFFERENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,17 +52,17 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
|
|||
}
|
||||
|
||||
public ServletContext getServletContext() {
|
||||
return (getWebServer() != null ? getWebServer().getServletContext() : null);
|
||||
return (getWebServer() != null) ? getWebServer().getServletContext() : null;
|
||||
}
|
||||
|
||||
public RegisteredServlet getRegisteredServlet(int index) {
|
||||
return (getWebServer() != null ? getWebServer().getRegisteredServlet(index)
|
||||
: null);
|
||||
return (getWebServer() != null) ? getWebServer().getRegisteredServlet(index)
|
||||
: null;
|
||||
}
|
||||
|
||||
public RegisteredFilter getRegisteredFilter(int index) {
|
||||
return (getWebServer() != null ? getWebServer().getRegisteredFilters(index)
|
||||
: null);
|
||||
return (getWebServer() != null) ? getWebServer().getRegisteredFilters(index)
|
||||
: null;
|
||||
}
|
||||
|
||||
public static class MockServletWebServer
|
||||
|
|
|
@ -86,7 +86,7 @@ public class AuditEvent implements Serializable {
|
|||
Assert.notNull(timestamp, "Timestamp must not be null");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
this.timestamp = timestamp;
|
||||
this.principal = (principal != null ? principal : "");
|
||||
this.principal = (principal != null) ? principal : "";
|
||||
this.type = type;
|
||||
this.data = Collections.unmodifiableMap(data);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class AuditEventsEndpoint {
|
|||
}
|
||||
|
||||
private Instant getInstant(OffsetDateTime offsetDateTime) {
|
||||
return (offsetDateTime != null ? offsetDateTime.toInstant() : null);
|
||||
return (offsetDateTime != null) ? offsetDateTime.toInstant() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -118,7 +118,7 @@ public class BeansEndpoint {
|
|||
}
|
||||
ConfigurableApplicationContext parent = getConfigurableParent(context);
|
||||
return new ContextBeans(describeBeans(context.getBeanFactory()),
|
||||
parent != null ? parent.getId() : null);
|
||||
(parent != null) ? parent.getId() : null);
|
||||
}
|
||||
|
||||
private static Map<String, BeanDescriptor> describeBeans(
|
||||
|
|
|
@ -118,7 +118,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
|
|||
prefix, sanitize(prefix, safeSerialize(mapper, bean, prefix))));
|
||||
});
|
||||
return new ContextConfigurationProperties(beanDescriptors,
|
||||
context.getParent() != null ? context.getParent().getId() : null);
|
||||
(context.getParent() != null) ? context.getParent().getId() : null);
|
||||
}
|
||||
|
||||
private ConfigurationBeanFactoryMetadata getBeanFactoryMetadata(
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ElasticsearchHealthIndicator extends AbstractHealthIndicator {
|
|||
public ElasticsearchHealthIndicator(Client client, long responseTimeout,
|
||||
List<String> indices) {
|
||||
this(client, responseTimeout,
|
||||
(indices != null ? StringUtils.toStringArray(indices) : null));
|
||||
(indices != null) ? StringUtils.toStringArray(indices) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,7 +39,7 @@ public class JacksonJmxOperationResponseMapper implements JmxOperationResponseMa
|
|||
private final JavaType mapType;
|
||||
|
||||
public JacksonJmxOperationResponseMapper(ObjectMapper objectMapper) {
|
||||
this.objectMapper = (objectMapper != null ? objectMapper : new ObjectMapper());
|
||||
this.objectMapper = (objectMapper != null) ? objectMapper : new ObjectMapper();
|
||||
this.listType = this.objectMapper.getTypeFactory()
|
||||
.constructParametricType(List.class, Object.class);
|
||||
this.mapType = this.objectMapper.getTypeFactory()
|
||||
|
|
|
@ -46,7 +46,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
|||
*/
|
||||
public PathMappedEndpoints(String basePath, EndpointsSupplier<?> supplier) {
|
||||
Assert.notNull(supplier, "Supplier must not be null");
|
||||
this.basePath = (basePath != null ? basePath : "");
|
||||
this.basePath = (basePath != null) ? basePath : "";
|
||||
this.endpoints = getEndpoints(Collections.singleton(supplier));
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
|||
public PathMappedEndpoints(String basePath,
|
||||
Collection<EndpointsSupplier<?>> suppliers) {
|
||||
Assert.notNull(suppliers, "Suppliers must not be null");
|
||||
this.basePath = (basePath != null ? basePath : "");
|
||||
this.basePath = (basePath != null) ? basePath : "";
|
||||
this.endpoints = getEndpoints(suppliers);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
|||
*/
|
||||
public String getRootPath(String endpointId) {
|
||||
PathMappedEndpoint endpoint = getEndpoint(endpointId);
|
||||
return (endpoint != null ? endpoint.getRootPath() : null);
|
||||
return (endpoint != null) ? endpoint.getRootPath() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -144,7 +144,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
|||
}
|
||||
|
||||
private String getPath(PathMappedEndpoint endpoint) {
|
||||
return (endpoint != null ? this.basePath + "/" + endpoint.getRootPath() : null);
|
||||
return (endpoint != null) ? this.basePath + "/" + endpoint.getRootPath() : null;
|
||||
}
|
||||
|
||||
private <T> List<T> asList(Stream<T> stream) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ServletEndpointRegistrar implements ServletContextInitializer {
|
|||
public ServletEndpointRegistrar(String basePath,
|
||||
Collection<ExposableServletEndpoint> servletEndpoints) {
|
||||
Assert.notNull(servletEndpoints, "ServletEndpoints must not be null");
|
||||
this.basePath = (basePath != null ? basePath : "");
|
||||
this.basePath = (basePath != null) ? basePath : "";
|
||||
this.servletEndpoints = servletEndpoints;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ public class JerseyEndpointResourceFactory {
|
|||
Map<String, Object> result = new HashMap<>();
|
||||
multivaluedMap.forEach((name, values) -> {
|
||||
if (!CollectionUtils.isEmpty(values)) {
|
||||
result.put(name, values.size() != 1 ? values : values.get(0));
|
||||
result.put(name, (values.size() != 1) ? values : values.get(0));
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
|
|
@ -310,7 +310,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
|
|||
arguments.putAll(body);
|
||||
}
|
||||
exchange.getRequest().getQueryParams().forEach((name, values) -> arguments
|
||||
.put(name, values.size() != 1 ? values : values.get(0)));
|
||||
.put(name, (values.size() != 1) ? values : values.get(0)));
|
||||
return arguments;
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
|
|||
.onErrorMap(InvalidEndpointRequestException.class,
|
||||
(ex) -> new ResponseStatusException(HttpStatus.BAD_REQUEST,
|
||||
ex.getReason()))
|
||||
.defaultIfEmpty(new ResponseEntity<>(httpMethod != HttpMethod.GET
|
||||
.defaultIfEmpty(new ResponseEntity<>((httpMethod != HttpMethod.GET)
|
||||
? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND));
|
||||
}
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping
|
|||
arguments.putAll(body);
|
||||
}
|
||||
request.getParameterMap().forEach((name, values) -> arguments.put(name,
|
||||
values.length != 1 ? Arrays.asList(values) : values[0]));
|
||||
(values.length != 1) ? Arrays.asList(values) : values[0]));
|
||||
return arguments;
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping
|
|||
|
||||
private Object handleResult(Object result, HttpMethod httpMethod) {
|
||||
if (result == null) {
|
||||
return new ResponseEntity<>(httpMethod != HttpMethod.GET
|
||||
return new ResponseEntity<>((httpMethod != HttpMethod.GET)
|
||||
? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND);
|
||||
}
|
||||
if (!(result instanceof WebEndpointResponse)) {
|
||||
|
|
|
@ -160,7 +160,7 @@ public class EnvironmentEndpoint {
|
|||
|
||||
private String getOrigin(OriginLookup<Object> lookup, String name) {
|
||||
Origin origin = lookup.getOrigin(name);
|
||||
return (origin != null ? origin.toString() : null);
|
||||
return (origin != null) ? origin.toString() : null;
|
||||
}
|
||||
|
||||
private PlaceholdersResolver getResolver() {
|
||||
|
|
|
@ -59,7 +59,7 @@ public class FlywayEndpoint {
|
|||
.put(name, new FlywayDescriptor(flyway.info().all())));
|
||||
ApplicationContext parent = target.getParent();
|
||||
contextFlywayBeans.put(target.getId(), new ContextFlywayBeans(flywayBeans,
|
||||
parent != null ? parent.getId() : null));
|
||||
(parent != null) ? parent.getId() : null));
|
||||
target = parent;
|
||||
}
|
||||
return new ApplicationFlywayBeans(contextFlywayBeans);
|
||||
|
@ -170,7 +170,7 @@ public class FlywayEndpoint {
|
|||
}
|
||||
|
||||
private String nullSafeToString(Object obj) {
|
||||
return (obj != null ? obj.toString() : null);
|
||||
return (obj != null) ? obj.toString() : null;
|
||||
}
|
||||
|
||||
public MigrationType getType() {
|
||||
|
|
|
@ -57,8 +57,8 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
|
|||
Assert.notNull(indicators, "Indicators must not be null");
|
||||
this.indicators = new LinkedHashMap<>(indicators);
|
||||
this.healthAggregator = healthAggregator;
|
||||
this.timeoutCompose = (mono) -> (this.timeout != null ? mono.timeout(
|
||||
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono);
|
||||
this.timeoutCompose = (mono) -> (this.timeout != null) ? mono.timeout(
|
||||
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,8 +85,8 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
|
|||
public CompositeReactiveHealthIndicator timeoutStrategy(long timeout,
|
||||
Health timeoutHealth) {
|
||||
this.timeout = timeout;
|
||||
this.timeoutHealth = (timeoutHealth != null ? timeoutHealth
|
||||
: Health.unknown().build());
|
||||
this.timeoutHealth = (timeoutHealth != null) ? timeoutHealth
|
||||
: Health.unknown().build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -98,7 +98,7 @@ public class OrderedHealthAggregator extends AbstractHealthAggregator {
|
|||
public int compare(Status s1, Status s2) {
|
||||
int i1 = this.statusOrder.indexOf(s1.getCode());
|
||||
int i2 = this.statusOrder.indexOf(s2.getCode());
|
||||
return (i1 < i2 ? -1 : (i1 != i2 ? 1 : s1.getCode().compareTo(s2.getCode())));
|
||||
return (i1 < i2) ? -1 : (i1 != i2) ? 1 : s1.getCode().compareTo(s2.getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator
|
|||
super("DataSource health check failed");
|
||||
this.dataSource = dataSource;
|
||||
this.query = query;
|
||||
this.jdbcTemplate = (dataSource != null ? new JdbcTemplate(dataSource) : null);
|
||||
this.jdbcTemplate = (dataSource != null) ? new JdbcTemplate(dataSource) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -69,7 +69,7 @@ public class LiquibaseEndpoint {
|
|||
createReport(liquibase, service, factory)));
|
||||
ApplicationContext parent = target.getParent();
|
||||
contextBeans.put(target.getId(), new ContextLiquibaseBeans(liquibaseBeans,
|
||||
parent != null ? parent.getId() : null));
|
||||
(parent != null) ? parent.getId() : null));
|
||||
target = parent;
|
||||
}
|
||||
return new ApplicationLiquibaseBeans(contextBeans);
|
||||
|
@ -210,7 +210,7 @@ public class LiquibaseEndpoint {
|
|||
this.execType = ranChangeSet.getExecType();
|
||||
this.id = ranChangeSet.getId();
|
||||
this.labels = ranChangeSet.getLabels().getLabels();
|
||||
this.checksum = (ranChangeSet.getLastCheckSum() != null
|
||||
this.checksum = ((ranChangeSet.getLastCheckSum() != null)
|
||||
? ranChangeSet.getLastCheckSum().toString() : null);
|
||||
this.orderExecuted = ranChangeSet.getOrderExecuted();
|
||||
this.tag = ranChangeSet.getTag();
|
||||
|
|
|
@ -73,7 +73,7 @@ public class LoggersEndpoint {
|
|||
Assert.notNull(name, "Name must not be null");
|
||||
LoggerConfiguration configuration = this.loggingSystem
|
||||
.getLoggerConfiguration(name);
|
||||
return (configuration != null ? new LoggerLevels(configuration) : null);
|
||||
return (configuration != null) ? new LoggerLevels(configuration) : null;
|
||||
}
|
||||
|
||||
@WriteOperation
|
||||
|
@ -112,7 +112,7 @@ public class LoggersEndpoint {
|
|||
}
|
||||
|
||||
private String getName(LogLevel level) {
|
||||
return (level != null ? level.name() : null);
|
||||
return (level != null) ? level.name() : null;
|
||||
}
|
||||
|
||||
public String getConfiguredLevel() {
|
||||
|
|
|
@ -78,7 +78,7 @@ public class HeapDumpWebEndpoint {
|
|||
if (this.lock.tryLock(this.timeout, TimeUnit.MILLISECONDS)) {
|
||||
try {
|
||||
return new WebEndpointResponse<>(
|
||||
dumpHeap(live != null ? live : true));
|
||||
dumpHeap((live != null) ? live : true));
|
||||
}
|
||||
finally {
|
||||
this.lock.unlock();
|
||||
|
|
|
@ -47,7 +47,7 @@ public class RabbitMetrics implements MeterBinder {
|
|||
public RabbitMetrics(ConnectionFactory connectionFactory, Iterable<Tag> tags) {
|
||||
Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
|
||||
this.connectionFactory = connectionFactory;
|
||||
this.tags = (tags != null ? tags : Collections.emptyList());
|
||||
this.tags = (tags != null) ? tags : Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -73,7 +73,7 @@ public final class RestTemplateExchangeTags {
|
|||
}
|
||||
|
||||
private static String ensureLeadingSlash(String url) {
|
||||
return (url == null || url.startsWith("/") ? url : "/" + url);
|
||||
return (url == null || url.startsWith("/")) ? url : "/" + url;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,7 +60,7 @@ public final class WebMvcTags {
|
|||
* @return the method tag whose value is a capitalized method (e.g. GET).
|
||||
*/
|
||||
public static Tag method(HttpServletRequest request) {
|
||||
return (request != null ? Tag.of("method", request.getMethod()) : METHOD_UNKNOWN);
|
||||
return (request != null) ? Tag.of("method", request.getMethod()) : METHOD_UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,9 +69,9 @@ public final class WebMvcTags {
|
|||
* @return the status tag derived from the status of the response
|
||||
*/
|
||||
public static Tag status(HttpServletResponse response) {
|
||||
return (response != null
|
||||
return (response != null)
|
||||
? Tag.of("status", Integer.toString(response.getStatus()))
|
||||
: STATUS_UNKNOWN);
|
||||
: STATUS_UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SolrHealthIndicator extends AbstractHealthIndicator {
|
|||
request.setAction(CoreAdminParams.CoreAdminAction.STATUS);
|
||||
CoreAdminResponse response = request.process(this.solrClient);
|
||||
int statusCode = response.getStatus();
|
||||
Status status = (statusCode != 0 ? Status.DOWN : Status.UP);
|
||||
Status status = (statusCode != 0) ? Status.DOWN : Status.UP;
|
||||
builder.status(status).withDetail("status", statusCode);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class MappingsEndpoint {
|
|||
this.descriptionProviders
|
||||
.forEach((provider) -> mappings.put(provider.getMappingName(),
|
||||
provider.describeMappings(applicationContext)));
|
||||
return new ContextMappings(mappings, applicationContext.getParent() != null
|
||||
return new ContextMappings(mappings, (applicationContext.getParent() != null)
|
||||
? applicationContext.getId() : null);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ final class DispatcherServletHandlerMappings {
|
|||
initializeDispatcherServletIfPossible();
|
||||
handlerMappings = this.dispatcherServlet.getHandlerMappings();
|
||||
}
|
||||
return (handlerMappings != null ? handlerMappings : Collections.emptyList());
|
||||
return (handlerMappings != null) ? handlerMappings : Collections.emptyList();
|
||||
}
|
||||
|
||||
private void initializeDispatcherServletIfPossible() {
|
||||
|
|
|
@ -98,8 +98,8 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
|
|||
HttpTrace trace = this.tracer.receivedRequest(request);
|
||||
return chain.filter(exchange).doAfterSuccessOrError((aVoid, ex) -> {
|
||||
TraceableServerHttpResponse response = new TraceableServerHttpResponse(
|
||||
(ex != null ? new CustomStatusResponseDecorator(ex,
|
||||
exchange.getResponse()) : exchange.getResponse()));
|
||||
(ex != null) ? new CustomStatusResponseDecorator(ex,
|
||||
exchange.getResponse()) : exchange.getResponse());
|
||||
this.tracer.sendingResponse(trace, response, () -> principal,
|
||||
() -> getStartedSessionId(session));
|
||||
this.repository.add(trace);
|
||||
|
@ -107,7 +107,7 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
|
|||
}
|
||||
|
||||
private String getStartedSessionId(WebSession session) {
|
||||
return (session != null && session.isStarted() ? session.getId() : null);
|
||||
return (session != null && session.isStarted()) ? session.getId() : null;
|
||||
}
|
||||
|
||||
private static final class CustomStatusResponseDecorator
|
||||
|
@ -117,9 +117,9 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
|
|||
|
||||
private CustomStatusResponseDecorator(Throwable ex, ServerHttpResponse delegate) {
|
||||
super(delegate);
|
||||
this.status = (ex instanceof ResponseStatusException
|
||||
this.status = (ex instanceof ResponseStatusException)
|
||||
? ((ResponseStatusException) ex).getStatus()
|
||||
: HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
: HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -45,8 +45,8 @@ class ServerWebExchangeTraceableRequest implements TraceableRequest {
|
|||
this.method = request.getMethodValue();
|
||||
this.headers = request.getHeaders();
|
||||
this.uri = request.getURI();
|
||||
this.remoteAddress = (request.getRemoteAddress() != null
|
||||
? request.getRemoteAddress().getAddress().toString() : null);
|
||||
this.remoteAddress = (request.getRemoteAddress() != null)
|
||||
? request.getRemoteAddress().getAddress().toString() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,8 +38,8 @@ class TraceableServerHttpResponse implements TraceableResponse {
|
|||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return (this.response.getStatusCode() != null
|
||||
? this.response.getStatusCode().value() : 200);
|
||||
return (this.response.getStatusCode() != null)
|
||||
? this.response.getStatusCode().value() : 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -92,7 +92,7 @@ public class HttpTraceFilter extends OncePerRequestFilter implements Ordered {
|
|||
}
|
||||
finally {
|
||||
TraceableHttpServletResponse traceableResponse = new TraceableHttpServletResponse(
|
||||
status != response.getStatus()
|
||||
(status != response.getStatus())
|
||||
? new CustomStatusResponseWrapper(response, status)
|
||||
: response);
|
||||
this.tracer.sendingResponse(trace, traceableResponse,
|
||||
|
@ -113,7 +113,7 @@ public class HttpTraceFilter extends OncePerRequestFilter implements Ordered {
|
|||
|
||||
private String getSessionId(HttpServletRequest request) {
|
||||
HttpSession session = request.getSession(false);
|
||||
return (session != null ? session.getId() : null);
|
||||
return (session != null) ? session.getId() : null;
|
||||
}
|
||||
|
||||
private static final class CustomStatusResponseWrapper
|
||||
|
|
|
@ -255,7 +255,7 @@ public class ConfigurationPropertiesReportEndpointTests {
|
|||
}
|
||||
|
||||
public boolean isMixedBoolean() {
|
||||
return (this.mixedBoolean != null ? this.mixedBoolean : false);
|
||||
return (this.mixedBoolean != null) ? this.mixedBoolean : false;
|
||||
}
|
||||
|
||||
public void setMixedBoolean(Boolean mixedBoolean) {
|
||||
|
|
|
@ -56,8 +56,8 @@ public class ReflectiveOperationInvokerTests {
|
|||
this.operationMethod = new OperationMethod(
|
||||
ReflectionUtils.findMethod(Example.class, "reverse", String.class),
|
||||
OperationType.READ);
|
||||
this.parameterValueMapper = (parameter,
|
||||
value) -> (value != null ? value.toString() : null);
|
||||
this.parameterValueMapper = (parameter, value) -> (value != null)
|
||||
? value.toString() : null;
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -190,9 +190,9 @@ public class JmxEndpointExporterTests {
|
|||
@Override
|
||||
public ObjectName getObjectName(ExposableJmxEndpoint endpoint)
|
||||
throws MalformedObjectNameException {
|
||||
return (endpoint != null
|
||||
return (endpoint != null)
|
||||
? new ObjectName("boot:type=Endpoint,name=" + endpoint.getId())
|
||||
: null);
|
||||
: null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ public class TestJmxOperation implements JmxOperation {
|
|||
|
||||
@Override
|
||||
public Object invoke(InvocationContext context) {
|
||||
return (this.invoke != null ? this.invoke.apply(context.getArguments())
|
||||
: "result");
|
||||
return (this.invoke != null) ? this.invoke.apply(context.getArguments())
|
||||
: "result";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -835,7 +835,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
|||
|
||||
@ReadOperation
|
||||
public String read(@Nullable Principal principal) {
|
||||
return (principal != null ? principal.getName() : "None");
|
||||
return (principal != null) ? principal.getName() : "None";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -856,7 +856,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
|||
@ReadOperation
|
||||
public String read(SecurityContext securityContext) {
|
||||
Principal principal = securityContext.getPrincipal();
|
||||
return (principal != null ? principal.getName() : "None");
|
||||
return (principal != null) ? principal.getName() : "None";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ public class HttpExchangeTracerTests {
|
|||
private String mixedCase(String input) {
|
||||
StringBuilder output = new StringBuilder();
|
||||
for (int i = 0; i < input.length(); i++) {
|
||||
output.append(i % 2 != 0 ? Character.toUpperCase(input.charAt(i))
|
||||
output.append((i % 2 != 0) ? Character.toUpperCase(input.charAt(i))
|
||||
: Character.toLowerCase(input.charAt(i)));
|
||||
}
|
||||
return output.toString();
|
||||
|
|
|
@ -225,7 +225,7 @@ public class AutoConfigurationImportSelector
|
|||
}
|
||||
String[] excludes = getEnvironment()
|
||||
.getProperty(PROPERTY_NAME_AUTOCONFIGURE_EXCLUDE, String[].class);
|
||||
return (excludes != null ? Arrays.asList(excludes) : Collections.emptyList());
|
||||
return (excludes != null) ? Arrays.asList(excludes) : Collections.emptyList();
|
||||
}
|
||||
|
||||
private List<String> filter(List<String> configurations,
|
||||
|
@ -273,7 +273,7 @@ public class AutoConfigurationImportSelector
|
|||
|
||||
protected final List<String> asList(AnnotationAttributes attributes, String name) {
|
||||
String[] value = attributes.getStringArray(name);
|
||||
return Arrays.asList(value != null ? value : new String[0]);
|
||||
return Arrays.asList((value != null) ? value : new String[0]);
|
||||
}
|
||||
|
||||
private void fireAutoConfigurationImportEvents(List<String> configurations,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -45,8 +45,8 @@ final class AutoConfigurationMetadataLoader {
|
|||
|
||||
static AutoConfigurationMetadata loadMetadata(ClassLoader classLoader, String path) {
|
||||
try {
|
||||
Enumeration<URL> urls = (classLoader != null ? classLoader.getResources(path)
|
||||
: ClassLoader.getSystemResources(path));
|
||||
Enumeration<URL> urls = (classLoader != null) ? classLoader.getResources(path)
|
||||
: ClassLoader.getSystemResources(path);
|
||||
Properties properties = new Properties();
|
||||
while (urls.hasMoreElements()) {
|
||||
properties.putAll(PropertiesLoaderUtils
|
||||
|
@ -89,7 +89,7 @@ final class AutoConfigurationMetadataLoader {
|
|||
@Override
|
||||
public Integer getInteger(String className, String key, Integer defaultValue) {
|
||||
String value = get(className, key);
|
||||
return (value != null ? Integer.valueOf(value) : defaultValue);
|
||||
return (value != null) ? Integer.valueOf(value) : defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,8 +101,8 @@ final class AutoConfigurationMetadataLoader {
|
|||
public Set<String> getSet(String className, String key,
|
||||
Set<String> defaultValue) {
|
||||
String value = get(className, key);
|
||||
return (value != null ? StringUtils.commaDelimitedListToSet(value)
|
||||
: defaultValue);
|
||||
return (value != null) ? StringUtils.commaDelimitedListToSet(value)
|
||||
: defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -113,7 +113,7 @@ final class AutoConfigurationMetadataLoader {
|
|||
@Override
|
||||
public String get(String className, String key, String defaultValue) {
|
||||
String value = this.properties.getProperty(className + "." + key);
|
||||
return (value != null ? value : defaultValue);
|
||||
return (value != null) ? value : defaultValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -213,8 +213,8 @@ class AutoConfigurationSorter {
|
|||
}
|
||||
Map<String, Object> attributes = getAnnotationMetadata()
|
||||
.getAnnotationAttributes(AutoConfigureOrder.class.getName());
|
||||
return (attributes != null ? (Integer) attributes.get("value")
|
||||
: AutoConfigureOrder.DEFAULT_ORDER);
|
||||
return (attributes != null) ? (Integer) attributes.get("value")
|
||||
: AutoConfigureOrder.DEFAULT_ORDER;
|
||||
}
|
||||
|
||||
private boolean wasProcessed() {
|
||||
|
|
|
@ -109,8 +109,8 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec
|
|||
for (String annotationName : ANNOTATION_NAMES) {
|
||||
AnnotationAttributes merged = AnnotatedElementUtils
|
||||
.getMergedAnnotationAttributes(source, annotationName);
|
||||
Class<?>[] exclude = (merged != null ? merged.getClassArray("exclude")
|
||||
: null);
|
||||
Class<?>[] exclude = (merged != null) ? merged.getClassArray("exclude")
|
||||
: null;
|
||||
if (exclude != null) {
|
||||
for (Class<?> excludeClass : exclude) {
|
||||
exclusions.add(excludeClass.getName());
|
||||
|
|
|
@ -110,8 +110,8 @@ public abstract class AbstractRabbitListenerContainerFactoryConfigurer<T extends
|
|||
builder.maxAttempts(retryConfig.getMaxAttempts());
|
||||
builder.backOffOptions(retryConfig.getInitialInterval().toMillis(),
|
||||
retryConfig.getMultiplier(), retryConfig.getMaxInterval().toMillis());
|
||||
MessageRecoverer recoverer = (this.messageRecoverer != null
|
||||
? this.messageRecoverer : new RejectAndDontRequeueRecoverer());
|
||||
MessageRecoverer recoverer = (this.messageRecoverer != null)
|
||||
? this.messageRecoverer : new RejectAndDontRequeueRecoverer();
|
||||
builder.recoverer(recoverer);
|
||||
factory.setAdviceChain(builder.build());
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ public class RabbitAutoConfiguration {
|
|||
|
||||
private boolean determineMandatoryFlag() {
|
||||
Boolean mandatory = this.properties.getTemplate().getMandatory();
|
||||
return (mandatory != null ? mandatory : this.properties.isPublisherReturns());
|
||||
return (mandatory != null) ? mandatory : this.properties.isPublisherReturns();
|
||||
}
|
||||
|
||||
private RetryTemplate createRetryTemplate(RabbitProperties.Retry properties) {
|
||||
|
|
|
@ -206,7 +206,7 @@ public class RabbitProperties {
|
|||
return this.username;
|
||||
}
|
||||
Address address = this.parsedAddresses.get(0);
|
||||
return (address.username != null ? address.username : this.username);
|
||||
return (address.username != null) ? address.username : this.username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
|
@ -229,7 +229,7 @@ public class RabbitProperties {
|
|||
return getPassword();
|
||||
}
|
||||
Address address = this.parsedAddresses.get(0);
|
||||
return (address.password != null ? address.password : getPassword());
|
||||
return (address.password != null) ? address.password : getPassword();
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
|
@ -256,7 +256,7 @@ public class RabbitProperties {
|
|||
return getVirtualHost();
|
||||
}
|
||||
Address address = this.parsedAddresses.get(0);
|
||||
return (address.virtualHost != null ? address.virtualHost : getVirtualHost());
|
||||
return (address.virtualHost != null) ? address.virtualHost : getVirtualHost();
|
||||
}
|
||||
|
||||
public void setVirtualHost(String virtualHost) {
|
||||
|
|
|
@ -36,8 +36,8 @@ public class CacheManagerCustomizers {
|
|||
|
||||
public CacheManagerCustomizers(
|
||||
List<? extends CacheManagerCustomizer<?>> customizers) {
|
||||
this.customizers = (customizers != null ? new ArrayList<>(customizers)
|
||||
: Collections.emptyList());
|
||||
this.customizers = (customizers != null) ? new ArrayList<>(customizers)
|
||||
: Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -147,8 +147,8 @@ public abstract class AbstractNestedCondition extends SpringBootCondition
|
|||
private List<String[]> getConditionClasses(AnnotatedTypeMetadata metadata) {
|
||||
MultiValueMap<String, Object> attributes = metadata
|
||||
.getAllAnnotationAttributes(Conditional.class.getName(), true);
|
||||
Object values = (attributes != null ? attributes.get("value") : null);
|
||||
return (List<String[]>) (values != null ? values : Collections.emptyList());
|
||||
Object values = (attributes != null) ? attributes.get("value") : null;
|
||||
return (List<String[]>) ((values != null) ? values : Collections.emptyList());
|
||||
}
|
||||
|
||||
private Condition getCondition(String conditionClassName) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -46,8 +46,8 @@ class ConditionEvaluationReportAutoConfigurationImportListener
|
|||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
this.beanFactory = (beanFactory instanceof ConfigurableListableBeanFactory
|
||||
? (ConfigurableListableBeanFactory) beanFactory : null);
|
||||
this.beanFactory = (beanFactory instanceof ConfigurableListableBeanFactory)
|
||||
? (ConfigurableListableBeanFactory) beanFactory : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public final class ConditionMessage {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (this.message != null ? this.message : "");
|
||||
return (this.message != null) ? this.message : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -358,7 +358,7 @@ public final class ConditionMessage {
|
|||
* @return a built {@link ConditionMessage}
|
||||
*/
|
||||
public ConditionMessage items(Style style, Object... items) {
|
||||
return items(style, items != null ? Arrays.asList(items) : null);
|
||||
return items(style, (items != null) ? Arrays.asList(items) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -415,7 +415,7 @@ public final class ConditionMessage {
|
|||
QUOTE {
|
||||
@Override
|
||||
protected String applyToItem(Object item) {
|
||||
return (item != null ? "'" + item + "'" : null);
|
||||
return (item != null) ? "'" + item + "'" : null;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -146,7 +146,7 @@ public class ConditionOutcome {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (this.message != null ? this.message.toString() : "");
|
||||
return (this.message != null) ? this.message.toString() : "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -444,7 +444,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
|
|||
}
|
||||
|
||||
public SearchStrategy getStrategy() {
|
||||
return (this.strategy != null ? this.strategy : SearchStrategy.ALL);
|
||||
return (this.strategy != null) ? this.strategy : SearchStrategy.ALL;
|
||||
}
|
||||
|
||||
public List<String> getNames() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -53,7 +53,7 @@ class OnJavaCondition extends SpringBootCondition {
|
|||
JavaVersion version) {
|
||||
boolean match = isWithin(runningVersion, range, version);
|
||||
String expected = String.format(
|
||||
range != Range.EQUAL_OR_NEWER ? "(older than %s)" : "(%s or newer)",
|
||||
(range != Range.EQUAL_OR_NEWER) ? "(older than %s)" : "(%s or newer)",
|
||||
version);
|
||||
ConditionMessage message = ConditionMessage
|
||||
.forCondition(ConditionalOnJava.class, expected)
|
||||
|
|
|
@ -139,7 +139,7 @@ class OnPropertyCondition extends SpringBootCondition {
|
|||
"The name or value attribute of @ConditionalOnProperty must be specified");
|
||||
Assert.state(value.length == 0 || name.length == 0,
|
||||
"The name and value attributes of @ConditionalOnProperty are exclusive");
|
||||
return (value.length > 0 ? value : name);
|
||||
return (value.length > 0) ? value : name;
|
||||
}
|
||||
|
||||
private void collectProperties(PropertyResolver resolver, List<String> missing,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -46,8 +46,8 @@ class OnResourceCondition extends SpringBootCondition {
|
|||
AnnotatedTypeMetadata metadata) {
|
||||
MultiValueMap<String, Object> attributes = metadata
|
||||
.getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true);
|
||||
ResourceLoader loader = (context.getResourceLoader() != null
|
||||
? context.getResourceLoader() : this.defaultResourceLoader);
|
||||
ResourceLoader loader = (context.getResourceLoader() != null)
|
||||
? context.getResourceLoader() : this.defaultResourceLoader;
|
||||
List<String> locations = new ArrayList<>();
|
||||
collectValues(locations, attributes.get("resources"));
|
||||
Assert.isTrue(!locations.isEmpty(),
|
||||
|
|
|
@ -158,7 +158,7 @@ public class CouchbaseAutoConfiguration {
|
|||
return factory.apply(service.getMinEndpoints(),
|
||||
service.getMaxEndpoints());
|
||||
}
|
||||
int endpoints = (fallback != null ? fallback : 1);
|
||||
int endpoints = (fallback != null) ? fallback : 1;
|
||||
return factory.apply(endpoints, endpoints);
|
||||
}
|
||||
|
||||
|
|
|
@ -227,8 +227,8 @@ public class CouchbaseProperties {
|
|||
private String keyStorePassword;
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return (this.enabled != null ? this.enabled
|
||||
: StringUtils.hasText(this.keyStore));
|
||||
return (this.enabled != null) ? this.enabled
|
||||
: StringUtils.hasText(this.keyStore);
|
||||
}
|
||||
|
||||
public void setEnabled(Boolean enabled) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class NoSuchBeanDefinitionFailureAnalyzer
|
|||
cause);
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append(String.format("%s required %s that could not be found.%n",
|
||||
(description != null ? description : "A component"),
|
||||
(description != null) ? description : "A component",
|
||||
getBeanDescription(cause)));
|
||||
for (AutoConfigurationResult result : autoConfigurationResults) {
|
||||
message.append(String.format("\t- %s%n", result));
|
||||
|
@ -97,9 +97,8 @@ class NoSuchBeanDefinitionFailureAnalyzer
|
|||
}
|
||||
String action = String.format("Consider %s %s in your configuration.",
|
||||
(!autoConfigurationResults.isEmpty()
|
||||
|| !userConfigurationResults.isEmpty()
|
||||
? "revisiting the entries above or defining"
|
||||
: "defining"),
|
||||
|| !userConfigurationResults.isEmpty())
|
||||
? "revisiting the entries above or defining" : "defining",
|
||||
getBeanDescription(cause));
|
||||
return new FailureAnalysis(message.toString(), action, cause);
|
||||
}
|
||||
|
@ -201,8 +200,8 @@ class NoSuchBeanDefinitionFailureAnalyzer
|
|||
|
||||
Source(String source) {
|
||||
String[] tokens = source.split("#");
|
||||
this.className = (tokens.length > 1 ? tokens[0] : source);
|
||||
this.methodName = (tokens.length != 2 ? null : tokens[1]);
|
||||
this.className = (tokens.length > 1) ? tokens[0] : source;
|
||||
this.methodName = (tokens.length != 2) ? null : tokens[1];
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
|
@ -262,8 +261,8 @@ class NoSuchBeanDefinitionFailureAnalyzer
|
|||
private boolean hasName(MethodMetadata methodMetadata, String name) {
|
||||
Map<String, Object> attributes = methodMetadata
|
||||
.getAnnotationAttributes(Bean.class.getName());
|
||||
String[] candidates = (attributes != null ? (String[]) attributes.get("name")
|
||||
: null);
|
||||
String[] candidates = (attributes != null) ? (String[]) attributes.get("name")
|
||||
: null;
|
||||
if (candidates != null) {
|
||||
for (String candidate : candidates) {
|
||||
if (candidate.equals(name)) {
|
||||
|
|
|
@ -160,7 +160,7 @@ public class FlywayAutoConfiguration {
|
|||
private String getProperty(Supplier<String> property,
|
||||
Supplier<String> defaultValue) {
|
||||
String value = property.get();
|
||||
return (value != null ? value : defaultValue.get());
|
||||
return (value != null) ? value : defaultValue.get();
|
||||
}
|
||||
|
||||
private void checkLocationExists(String... locations) {
|
||||
|
|
|
@ -109,7 +109,7 @@ public class FlywayProperties {
|
|||
}
|
||||
|
||||
public String getPassword() {
|
||||
return (this.password != null ? this.password : "");
|
||||
return (this.password != null) ? this.password : "";
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -104,7 +104,7 @@ public class HttpEncodingProperties {
|
|||
}
|
||||
|
||||
public boolean shouldForce(Type type) {
|
||||
Boolean force = (type != Type.REQUEST ? this.forceResponse : this.forceRequest);
|
||||
Boolean force = (type != Type.REQUEST) ? this.forceResponse : this.forceRequest;
|
||||
if (force == null) {
|
||||
force = this.force;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -69,7 +69,7 @@ public class HttpMessageConvertersAutoConfiguration {
|
|||
@ConditionalOnMissingBean
|
||||
public HttpMessageConverters messageConverters() {
|
||||
return new HttpMessageConverters(
|
||||
this.converters != null ? this.converters : Collections.emptyList());
|
||||
(this.converters != null) ? this.converters : Collections.emptyList());
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -91,7 +91,7 @@ public class ProjectInfoAutoConfiguration {
|
|||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||
AnnotatedTypeMetadata metadata) {
|
||||
ResourceLoader loader = context.getResourceLoader();
|
||||
loader = (loader != null ? loader : this.defaultResourceLoader);
|
||||
loader = (loader != null) ? loader : this.defaultResourceLoader;
|
||||
Environment environment = context.getEnvironment();
|
||||
String location = environment.getProperty("spring.info.git.location");
|
||||
if (location == null) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -121,7 +121,7 @@ public class DataSourceAutoConfiguration {
|
|||
private ClassLoader getDataSourceClassLoader(ConditionContext context) {
|
||||
Class<?> dataSourceClass = DataSourceBuilder
|
||||
.findType(context.getClassLoader());
|
||||
return (dataSourceClass != null ? dataSourceClass.getClassLoader() : null);
|
||||
return (dataSourceClass != null) ? dataSourceClass.getClassLoader() : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ class DataSourceInitializer {
|
|||
ResourceLoader resourceLoader) {
|
||||
this.dataSource = dataSource;
|
||||
this.properties = properties;
|
||||
this.resourceLoader = (resourceLoader != null ? resourceLoader
|
||||
: new DefaultResourceLoader());
|
||||
this.resourceLoader = (resourceLoader != null) ? resourceLoader
|
||||
: new DefaultResourceLoader();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -277,8 +277,8 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
|
|||
return this.url;
|
||||
}
|
||||
String databaseName = determineDatabaseName();
|
||||
String url = (databaseName != null
|
||||
? this.embeddedDatabaseConnection.getUrl(databaseName) : null);
|
||||
String url = (databaseName != null)
|
||||
? this.embeddedDatabaseConnection.getUrl(databaseName) : null;
|
||||
if (!StringUtils.hasText(url)) {
|
||||
throw new DataSourceBeanCreationException(
|
||||
"Failed to determine suitable jdbc url", this,
|
||||
|
|
|
@ -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.
|
||||
|
@ -126,9 +126,9 @@ public class JmsProperties {
|
|||
|
||||
public String formatConcurrency() {
|
||||
if (this.concurrency == null) {
|
||||
return (this.maxConcurrency != null ? "1-" + this.maxConcurrency : null);
|
||||
return (this.maxConcurrency != null) ? "1-" + this.maxConcurrency : null;
|
||||
}
|
||||
return (this.maxConcurrency != null
|
||||
return ((this.maxConcurrency != null)
|
||||
? this.concurrency + "-" + this.maxConcurrency
|
||||
: String.valueOf(this.concurrency));
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ class ActiveMQConnectionFactoryFactory {
|
|||
List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
|
||||
Assert.notNull(properties, "Properties must not be null");
|
||||
this.properties = properties;
|
||||
this.factoryCustomizers = (factoryCustomizers != null ? factoryCustomizers
|
||||
: Collections.emptyList());
|
||||
this.factoryCustomizers = (factoryCustomizers != null) ? factoryCustomizers
|
||||
: Collections.emptyList();
|
||||
}
|
||||
|
||||
public <T extends ActiveMQConnectionFactory> T createConnectionFactory(
|
||||
|
|
|
@ -170,7 +170,7 @@ public class LiquibaseAutoConfiguration {
|
|||
private String getProperty(Supplier<String> property,
|
||||
Supplier<String> defaultValue) {
|
||||
String value = property.get();
|
||||
return (value != null ? value : defaultValue.get());
|
||||
return (value != null) ? value : defaultValue.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -81,8 +81,8 @@ public class MongoClientFactory {
|
|||
if (options == null) {
|
||||
options = MongoClientOptions.builder().build();
|
||||
}
|
||||
String host = (this.properties.getHost() != null ? this.properties.getHost()
|
||||
: "localhost");
|
||||
String host = (this.properties.getHost() != null) ? this.properties.getHost()
|
||||
: "localhost";
|
||||
return new MongoClient(Collections.singletonList(new ServerAddress(host, port)),
|
||||
options);
|
||||
}
|
||||
|
@ -101,8 +101,8 @@ public class MongoClientFactory {
|
|||
int port = getValue(properties.getPort(), MongoProperties.DEFAULT_PORT);
|
||||
List<ServerAddress> seeds = Collections
|
||||
.singletonList(new ServerAddress(host, port));
|
||||
return (credentials != null ? new MongoClient(seeds, credentials, options)
|
||||
: new MongoClient(seeds, options));
|
||||
return (credentials != null) ? new MongoClient(seeds, credentials, options)
|
||||
: new MongoClient(seeds, options);
|
||||
}
|
||||
return createMongoClient(MongoProperties.DEFAULT_URI, options);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class MongoClientFactory {
|
|||
}
|
||||
|
||||
private <T> T getValue(T value, T fallback) {
|
||||
return (value != null ? value : fallback);
|
||||
return (value != null) ? value : fallback;
|
||||
}
|
||||
|
||||
private boolean hasCustomAddress() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -143,7 +143,7 @@ public class MongoProperties {
|
|||
}
|
||||
|
||||
public String determineUri() {
|
||||
return (this.uri != null ? this.uri : DEFAULT_URI);
|
||||
return (this.uri != null) ? this.uri : DEFAULT_URI;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
|
|
|
@ -54,8 +54,8 @@ public class ReactiveMongoClientFactory {
|
|||
List<MongoClientSettingsBuilderCustomizer> builderCustomizers) {
|
||||
this.properties = properties;
|
||||
this.environment = environment;
|
||||
this.builderCustomizers = (builderCustomizers != null ? builderCustomizers
|
||||
: Collections.emptyList());
|
||||
this.builderCustomizers = (builderCustomizers != null) ? builderCustomizers
|
||||
: Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,8 +86,8 @@ public class ReactiveMongoClientFactory {
|
|||
private MongoClient createEmbeddedMongoClient(MongoClientSettings settings,
|
||||
int port) {
|
||||
Builder builder = builder(settings);
|
||||
String host = (this.properties.getHost() != null ? this.properties.getHost()
|
||||
: "localhost");
|
||||
String host = (this.properties.getHost() != null) ? this.properties.getHost()
|
||||
: "localhost";
|
||||
ClusterSettings clusterSettings = ClusterSettings.builder()
|
||||
.hosts(Collections.singletonList(new ServerAddress(host, port))).build();
|
||||
builder.clusterSettings(clusterSettings);
|
||||
|
@ -119,16 +119,16 @@ public class ReactiveMongoClientFactory {
|
|||
}
|
||||
|
||||
private void applyCredentials(Builder builder) {
|
||||
String database = (this.properties.getAuthenticationDatabase() != null
|
||||
String database = (this.properties.getAuthenticationDatabase() != null)
|
||||
? this.properties.getAuthenticationDatabase()
|
||||
: this.properties.getMongoClientDatabase());
|
||||
: this.properties.getMongoClientDatabase();
|
||||
builder.credential((MongoCredential.createCredential(
|
||||
this.properties.getUsername(), database, this.properties.getPassword())));
|
||||
|
||||
}
|
||||
|
||||
private <T> T getOrDefault(T value, T defaultValue) {
|
||||
return (value != null ? value : defaultValue);
|
||||
return (value != null) ? value : defaultValue;
|
||||
}
|
||||
|
||||
private MongoClient createMongoClient(Builder builder) {
|
||||
|
|
|
@ -131,13 +131,12 @@ public class EmbeddedMongoAutoConfiguration {
|
|||
this.embeddedProperties.getFeatures());
|
||||
MongodConfigBuilder builder = new MongodConfigBuilder()
|
||||
.version(featureAwareVersion);
|
||||
if (this.embeddedProperties.getStorage() != null) {
|
||||
builder.replication(
|
||||
new Storage(this.embeddedProperties.getStorage().getDatabaseDir(),
|
||||
this.embeddedProperties.getStorage().getReplSetName(),
|
||||
this.embeddedProperties.getStorage().getOplogSize() != null
|
||||
? this.embeddedProperties.getStorage().getOplogSize()
|
||||
: 0));
|
||||
EmbeddedMongoProperties.Storage storage = this.embeddedProperties.getStorage();
|
||||
if (storage != null) {
|
||||
String databaseDir = storage.getDatabaseDir();
|
||||
String replSetName = storage.getReplSetName();
|
||||
int oplogSize = (storage.getOplogSize() != null) ? storage.getOplogSize() : 0;
|
||||
builder.replication(new Storage(databaseDir, replSetName, oplogSize));
|
||||
}
|
||||
Integer configuredPort = this.properties.getPort();
|
||||
if (configuredPort != null && configuredPort > 0) {
|
||||
|
@ -257,7 +256,7 @@ public class EmbeddedMongoAutoConfiguration {
|
|||
Set<Feature> features) {
|
||||
Assert.notNull(version, "version must not be null");
|
||||
this.version = version;
|
||||
this.features = (features != null ? features : Collections.emptySet());
|
||||
this.features = (features != null) ? features : Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -83,8 +83,8 @@ class DataSourceInitializedPublisher implements BeanPostProcessor {
|
|||
private DataSource findDataSource(EntityManagerFactory entityManagerFactory) {
|
||||
Object dataSource = entityManagerFactory.getProperties()
|
||||
.get("javax.persistence.nonJtaDataSource");
|
||||
return (dataSource != null && dataSource instanceof DataSource
|
||||
? (DataSource) dataSource : this.dataSource);
|
||||
return (dataSource != null && dataSource instanceof DataSource)
|
||||
? (DataSource) dataSource : this.dataSource;
|
||||
}
|
||||
|
||||
private boolean isInitializingDatabase(DataSource dataSource) {
|
||||
|
|
|
@ -50,7 +50,7 @@ public class HibernateSettings {
|
|||
}
|
||||
|
||||
public String getDdlAuto() {
|
||||
return (this.ddlAuto != null ? this.ddlAuto.get() : null);
|
||||
return (this.ddlAuto != null) ? this.ddlAuto.get() : null;
|
||||
}
|
||||
|
||||
public HibernateSettings hibernatePropertiesCustomizers(
|
||||
|
|
|
@ -244,7 +244,7 @@ public class JpaProperties {
|
|||
if (ddlAuto != null) {
|
||||
return ddlAuto;
|
||||
}
|
||||
return (this.ddlAuto != null ? this.ddlAuto : defaultDdlAuto.get());
|
||||
return (this.ddlAuto != null) ? this.ddlAuto : defaultDdlAuto.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public class QuartzAutoConfiguration {
|
|||
private DataSource getDataSource(DataSource dataSource,
|
||||
ObjectProvider<DataSource> quartzDataSource) {
|
||||
DataSource dataSourceIfAvailable = quartzDataSource.getIfAvailable();
|
||||
return (dataSourceIfAvailable != null ? dataSourceIfAvailable : dataSource);
|
||||
return (dataSourceIfAvailable != null) ? dataSourceIfAvailable : dataSource;
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -71,15 +71,15 @@ final class OAuth2ClientPropertiesRegistrationAdapter {
|
|||
|
||||
private static Builder getBuilder(String registrationId, String configuredProviderId,
|
||||
Map<String, Provider> providers) {
|
||||
String providerId = (configuredProviderId != null ? configuredProviderId
|
||||
: registrationId);
|
||||
String providerId = (configuredProviderId != null) ? configuredProviderId
|
||||
: registrationId;
|
||||
CommonOAuth2Provider provider = getCommonProvider(providerId);
|
||||
if (provider == null && !providers.containsKey(providerId)) {
|
||||
throw new IllegalStateException(
|
||||
getErrorMessage(configuredProviderId, registrationId));
|
||||
}
|
||||
Builder builder = (provider != null ? provider.getBuilder(registrationId)
|
||||
: ClientRegistration.withRegistrationId(registrationId));
|
||||
Builder builder = (provider != null) ? provider.getBuilder(registrationId)
|
||||
: ClientRegistration.withRegistrationId(registrationId);
|
||||
if (providers.containsKey(providerId)) {
|
||||
return getBuilder(builder, providers.get(providerId));
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ final class OAuth2ClientPropertiesRegistrationAdapter {
|
|||
|
||||
private static String getErrorMessage(String configuredProviderId,
|
||||
String registrationId) {
|
||||
return (configuredProviderId != null
|
||||
return ((configuredProviderId != null)
|
||||
? "Unknown provider ID '" + configuredProviderId + "'"
|
||||
: "Provider ID must be specified for client registration '"
|
||||
+ registrationId + "'");
|
||||
|
|
|
@ -93,7 +93,7 @@ final class SessionStoreMappings {
|
|||
}
|
||||
|
||||
private String getName(Class<?> configuration) {
|
||||
return (configuration != null ? configuration.getName() : null);
|
||||
return (configuration != null) ? configuration.getName() : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
@ -120,7 +120,7 @@ public abstract class AbstractViewResolverProperties {
|
|||
}
|
||||
|
||||
public String getCharsetName() {
|
||||
return (this.charset != null ? this.charset.name() : null);
|
||||
return (this.charset != null) ? this.charset.name() : null;
|
||||
}
|
||||
|
||||
public void setCharset(Charset charset) {
|
||||
|
|
|
@ -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.
|
||||
|
@ -76,7 +76,7 @@ public class TemplateAvailabilityProviders {
|
|||
* @param applicationContext the source application context
|
||||
*/
|
||||
public TemplateAvailabilityProviders(ApplicationContext applicationContext) {
|
||||
this(applicationContext != null ? applicationContext.getClassLoader() : null);
|
||||
this((applicationContext != null) ? applicationContext.getClassLoader() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -143,12 +143,12 @@ public class TemplateAvailabilityProviders {
|
|||
if (provider == null) {
|
||||
synchronized (this.cache) {
|
||||
provider = findProvider(view, environment, classLoader, resourceLoader);
|
||||
provider = (provider != null ? provider : NONE);
|
||||
provider = (provider != null) ? provider : NONE;
|
||||
this.resolved.put(view, provider);
|
||||
this.cache.put(view, provider);
|
||||
}
|
||||
}
|
||||
return (provider != NONE ? provider : null);
|
||||
return (provider != NONE) ? provider : null;
|
||||
}
|
||||
|
||||
private TemplateAvailabilityProvider findProvider(String view,
|
||||
|
|
|
@ -36,8 +36,8 @@ public class TransactionManagerCustomizers {
|
|||
|
||||
public TransactionManagerCustomizers(
|
||||
Collection<? extends PlatformTransactionManagerCustomizer<?>> customizers) {
|
||||
this.customizers = (customizers != null ? new ArrayList<>(customizers)
|
||||
: Collections.emptyList());
|
||||
this.customizers = (customizers != null) ? new ArrayList<>(customizers)
|
||||
: Collections.emptyList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -164,7 +164,7 @@ public class ResourceProperties {
|
|||
|
||||
static Boolean getEnabled(boolean fixedEnabled, boolean contentEnabled,
|
||||
Boolean chainEnabled) {
|
||||
return (fixedEnabled || contentEnabled ? Boolean.TRUE : chainEnabled);
|
||||
return (fixedEnabled || contentEnabled) ? Boolean.TRUE : chainEnabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -110,9 +110,9 @@ public class TomcatWebServerFactoryCustomizer implements
|
|||
}
|
||||
|
||||
private int determineMaxHttpHeaderSize() {
|
||||
return (this.serverProperties.getMaxHttpHeaderSize() > 0
|
||||
return (this.serverProperties.getMaxHttpHeaderSize() > 0)
|
||||
? this.serverProperties.getMaxHttpHeaderSize()
|
||||
: this.serverProperties.getTomcat().getMaxHttpHeaderSize());
|
||||
: this.serverProperties.getTomcat().getMaxHttpHeaderSize();
|
||||
}
|
||||
|
||||
private void customizeAcceptCount(ConfigurableTomcatWebServerFactory factory,
|
||||
|
|
|
@ -205,7 +205,7 @@ public abstract class AbstractErrorWebExceptionHandler
|
|||
}
|
||||
|
||||
private String htmlEscape(Object input) {
|
||||
return (input != null ? HtmlUtils.htmlEscape(input.toString()) : null);
|
||||
return (input != null) ? HtmlUtils.htmlEscape(input.toString()) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -338,7 +338,7 @@ public class WebMvcAutoConfiguration {
|
|||
}
|
||||
|
||||
private Integer getSeconds(Duration cachePeriod) {
|
||||
return (cachePeriod != null ? (int) cachePeriod.getSeconds() : null);
|
||||
return (cachePeriod != null) ? (int) cachePeriod.getSeconds() : null;
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -91,7 +91,7 @@ public class BasicErrorController extends AbstractErrorController {
|
|||
request, isIncludeStackTrace(request, MediaType.TEXT_HTML)));
|
||||
response.setStatus(status.value());
|
||||
ModelAndView modelAndView = resolveErrorView(request, response, status, model);
|
||||
return (modelAndView != null ? modelAndView : new ModelAndView("error", model));
|
||||
return (modelAndView != null) ? modelAndView : new ModelAndView("error", model);
|
||||
}
|
||||
|
||||
@RequestMapping
|
||||
|
|
|
@ -316,11 +316,13 @@ public class ErrorMvcAutoConfiguration {
|
|||
@Override
|
||||
public String resolvePlaceholder(String placeholderName) {
|
||||
Expression expression = this.expressions.get(placeholderName);
|
||||
return escape(expression != null ? expression.getValue(this.context) : null);
|
||||
Object expressionValue = (expression != null)
|
||||
? expression.getValue(this.context) : null;
|
||||
return escape(expressionValue);
|
||||
}
|
||||
|
||||
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 HazelcastJpaDependencyAutoConfigurationTests {
|
|||
String[] dependsOn = ((BeanDefinitionRegistry) context
|
||||
.getSourceApplicationContext()).getBeanDefinition("entityManagerFactory")
|
||||
.getDependsOn();
|
||||
return (dependsOn != null ? Arrays.asList(dependsOn) : Collections.emptyList());
|
||||
return (dependsOn != null) ? Arrays.asList(dependsOn) : Collections.emptyList();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
|
|
@ -52,17 +52,17 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
|
|||
}
|
||||
|
||||
public ServletContext getServletContext() {
|
||||
return (getWebServer() != null ? getWebServer().getServletContext() : null);
|
||||
return (getWebServer() != null) ? getWebServer().getServletContext() : null;
|
||||
}
|
||||
|
||||
public RegisteredServlet getRegisteredServlet(int index) {
|
||||
return (getWebServer() != null ? getWebServer().getRegisteredServlet(index)
|
||||
: null);
|
||||
return (getWebServer() != null) ? getWebServer().getRegisteredServlet(index)
|
||||
: null;
|
||||
}
|
||||
|
||||
public RegisteredFilter getRegisteredFilter(int index) {
|
||||
return (getWebServer() != null ? getWebServer().getRegisteredFilters(index)
|
||||
: null);
|
||||
return (getWebServer() != null) ? getWebServer().getRegisteredFilters(index)
|
||||
: null;
|
||||
}
|
||||
|
||||
public static class MockServletWebServer
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue