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