Merge branch '2.0.x'

pull/5066/head
Phillip Webb 7 years ago
commit b6a2a46f78

@ -72,7 +72,7 @@ public class CloudFoundryWebEndpointDiscoverer extends WebEndpointDiscoverer {
AnnotationAttributes attributes = AnnotatedElementUtils
.getMergedAnnotationAttributes(extensionBean.getClass(),
EndpointWebExtension.class);
Class<?> endpoint = (attributes == null ? null : attributes.getClass("endpoint"));
Class<?> endpoint = (attributes != null ? attributes.getClass("endpoint") : null);
return (endpoint != null && HealthEndpoint.class.isAssignableFrom(endpoint));
}

@ -126,9 +126,8 @@ public class ReactiveCloudFoundryActuatorAutoConfiguration {
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
boolean skipSslValidation = environment.getProperty(
"management.cloudfoundry.skip-ssl-validation", Boolean.class, false);
return (cloudControllerUrl == null ? null
: new ReactiveCloudFoundrySecurityService(webClientBuilder,
cloudControllerUrl, skipSslValidation));
return (cloudControllerUrl != null ? new ReactiveCloudFoundrySecurityService(
webClientBuilder, cloudControllerUrl, skipSslValidation) : null);
}
private CorsConfiguration getCorsConfiguration() {

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

@ -125,8 +125,8 @@ public class ConditionsReportEndpoint {
this.unconditionalClasses = report.getUnconditionalClasses();
report.getConditionAndOutcomesBySource().forEach(
(source, conditionAndOutcomes) -> add(source, conditionAndOutcomes));
this.parentId = context.getParent() == null ? null
: context.getParent().getId();
this.parentId = (context.getParent() != null ? context.getParent().getId()
: null);
}
private void add(String source, ConditionAndOutcomes conditionAndOutcomes) {

@ -82,7 +82,7 @@ public class ElasticsearchHealthIndicatorAutoConfiguration {
protected ElasticsearchHealthIndicator createHealthIndicator(Client client) {
Duration responseTimeout = this.properties.getResponseTimeout();
return new ElasticsearchHealthIndicator(client,
responseTimeout == null ? 100 : responseTimeout.toMillis(),
responseTimeout != null ? responseTimeout.toMillis() : 100,
this.properties.getIndices());
}

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

@ -68,10 +68,10 @@ public class PropertiesMeterFilter implements MeterFilter {
}
private long[] convertSla(Meter.Type meterType, ServiceLevelAgreementBoundary[] sla) {
long[] converted = Arrays.stream(sla == null ? EMPTY_SLA : sla)
long[] converted = Arrays.stream(sla != null ? sla : EMPTY_SLA)
.map((candidate) -> candidate.getValue(meterType))
.filter(Objects::nonNull).mapToLong(Long::longValue).toArray();
return (converted.length == 0 ? null : converted);
return (converted.length != 0 ? converted : null);
}
private <T> T lookup(Map<String, T> values, Id id, T defaultValue) {
@ -82,7 +82,7 @@ public class PropertiesMeterFilter implements MeterFilter {
return result;
}
int lastDot = name.lastIndexOf('.');
name = lastDot == -1 ? "" : name.substring(0, lastDot);
name = (lastDot != -1 ? name.substring(0, lastDot) : "");
}
return values.getOrDefault("all", defaultValue);
}

@ -60,7 +60,7 @@ public class WavefrontPropertiesConfigAdapter
}
private String getUriAsString(WavefrontProperties properties) {
return properties.getUri() == null ? null : properties.getUri().toString();
return (properties.getUri() != null ? properties.getUri().toString() : null);
}
}

@ -47,7 +47,7 @@ public class TomcatMetricsAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public TomcatMetrics tomcatMetrics() {
return new TomcatMetrics(this.context == null ? null : this.context.getManager(),
return new TomcatMetrics(this.context != null ? this.context.getManager() : null,
Collections.emptyList());
}

@ -125,8 +125,9 @@ class ManagementContextConfigurationImportSelector
Map<String, Object> annotationAttributes = annotationMetadata
.getAnnotationAttributes(
ManagementContextConfiguration.class.getName());
return (annotationAttributes == null ? ManagementContextType.ANY
: (ManagementContextType) annotationAttributes.get("value"));
return (annotationAttributes != null
? (ManagementContextType) annotationAttributes.get("value")
: ManagementContextType.ANY);
}
private int readOrder(AnnotationMetadata annotationMetadata) {

@ -105,7 +105,7 @@ public class JmxEndpointIntegrationTests {
getMBeanInfo(mBeanServer, objectName);
return true;
}
catch (InstanceNotFoundException e) {
catch (InstanceNotFoundException ex) {
return false;
}
}

@ -52,15 +52,17 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
}
public ServletContext getServletContext() {
return getWebServer() == null ? null : getWebServer().getServletContext();
return (getWebServer() != null ? getWebServer().getServletContext() : null);
}
public RegisteredServlet getRegisteredServlet(int index) {
return getWebServer() == null ? null : getWebServer().getRegisteredServlet(index);
return (getWebServer() != null ? getWebServer().getRegisteredServlet(index)
: null);
}
public RegisteredFilter getRegisteredFilter(int index) {
return getWebServer() == null ? null : getWebServer().getRegisteredFilters(index);
return (getWebServer() != null ? getWebServer().getRegisteredFilters(index)
: null);
}
public static class MockServletWebServer

@ -16,6 +16,7 @@
package org.springframework.boot.actuate.audit;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.util.List;
@ -43,8 +44,13 @@ public class AuditEventsEndpoint {
@ReadOperation
public AuditEventsDescriptor events(@Nullable String principal,
@Nullable OffsetDateTime after, @Nullable String type) {
return new AuditEventsDescriptor(this.auditEventRepository.find(principal,
after == null ? null : after.toInstant(), type));
List<AuditEvent> events = this.auditEventRepository.find(principal,
getInstant(after), type);
return new AuditEventsDescriptor(events);
}
private Instant getInstant(OffsetDateTime offsetDateTime) {
return (offsetDateTime != null ? offsetDateTime.toInstant() : null);
}
/**

@ -119,7 +119,7 @@ public class BeansEndpoint {
}
ConfigurableApplicationContext parent = getConfigurableParent(context);
return new ContextBeans(describeBeans(context.getBeanFactory()),
parent == null ? null : parent.getId());
parent != null ? parent.getId() : null);
}
private static Map<String, BeanDescriptor> describeBeans(
@ -168,8 +168,8 @@ public class BeansEndpoint {
private BeanDescriptor(String[] aliases, String scope, Class<?> type,
String resource, String[] dependencies) {
this.aliases = aliases;
this.scope = StringUtils.hasText(scope) ? scope
: BeanDefinition.SCOPE_SINGLETON;
this.scope = (StringUtils.hasText(scope) ? scope
: BeanDefinition.SCOPE_SINGLETON);
this.type = type;
this.resource = resource;
this.dependencies = dependencies;

@ -118,7 +118,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
prefix, sanitize(prefix, safeSerialize(mapper, bean, prefix))));
});
return new ContextConfigurationProperties(beanDescriptors,
context.getParent() == null ? null : context.getParent().getId());
context.getParent() != null ? context.getParent().getId() : null);
}
private ConfigurationBeanFactoryMetadata getBeanFactoryMetadata(

@ -55,7 +55,7 @@ public class ElasticsearchHealthIndicator extends AbstractHealthIndicator {
public ElasticsearchHealthIndicator(Client client, long responseTimeout,
List<String> indices) {
this(client, responseTimeout,
(indices == null ? null : StringUtils.toStringArray(indices)));
(indices != null ? StringUtils.toStringArray(indices) : null));
}
/**

@ -224,7 +224,7 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
}
private <T> T getLast(List<T> list) {
return CollectionUtils.isEmpty(list) ? null : list.get(list.size() - 1);
return (CollectionUtils.isEmpty(list) ? null : list.get(list.size() - 1));
}
private void assertNoDuplicateOperations(EndpointBean endpointBean,

@ -39,7 +39,7 @@ public class JacksonJmxOperationResponseMapper implements JmxOperationResponseMa
private final JavaType mapType;
public JacksonJmxOperationResponseMapper(ObjectMapper objectMapper) {
this.objectMapper = (objectMapper == null ? new ObjectMapper() : objectMapper);
this.objectMapper = (objectMapper != null ? objectMapper : new ObjectMapper());
this.listType = this.objectMapper.getTypeFactory()
.constructParametricType(List.class, Object.class);
this.mapType = this.objectMapper.getTypeFactory()

@ -46,7 +46,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
*/
public PathMappedEndpoints(String basePath, EndpointsSupplier<?> supplier) {
Assert.notNull(supplier, "Supplier must not be null");
this.basePath = (basePath == null ? "" : basePath);
this.basePath = (basePath != null ? basePath : "");
this.endpoints = getEndpoints(Collections.singleton(supplier));
}
@ -58,7 +58,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
public PathMappedEndpoints(String basePath,
Collection<EndpointsSupplier<?>> suppliers) {
Assert.notNull(suppliers, "Suppliers must not be null");
this.basePath = (basePath == null ? "" : basePath);
this.basePath = (basePath != null ? basePath : "");
this.endpoints = getEndpoints(suppliers);
}
@ -91,7 +91,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
*/
public String getRootPath(String endpointId) {
PathMappedEndpoint endpoint = getEndpoint(endpointId);
return (endpoint == null ? null : endpoint.getRootPath());
return (endpoint != null ? endpoint.getRootPath() : null);
}
/**
@ -144,7 +144,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
}
private String getPath(PathMappedEndpoint endpoint) {
return (endpoint == null ? null : this.basePath + "/" + endpoint.getRootPath());
return (endpoint != null ? this.basePath + "/" + endpoint.getRootPath() : null);
}
private <T> List<T> asList(Stream<T> stream) {

@ -46,7 +46,7 @@ public class ServletEndpointRegistrar implements ServletContextInitializer {
public ServletEndpointRegistrar(String basePath,
Collection<ExposableServletEndpoint> servletEndpoints) {
Assert.notNull(servletEndpoints, "ServletEndpoints must not be null");
this.basePath = (basePath == null ? "" : basePath);
this.basePath = (basePath != null ? basePath : "");
this.servletEndpoints = servletEndpoints;
}

@ -179,7 +179,7 @@ public class JerseyEndpointResourceFactory {
Map<String, Object> result = new HashMap<>();
multivaluedMap.forEach((name, values) -> {
if (!CollectionUtils.isEmpty(values)) {
result.put(name, values.size() == 1 ? values.get(0) : values);
result.put(name, values.size() != 1 ? values : values.get(0));
}
});
return result;

@ -309,7 +309,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
arguments.putAll(body);
}
exchange.getRequest().getQueryParams().forEach((name, values) -> arguments
.put(name, values.size() == 1 ? values.get(0) : values));
.put(name, values.size() != 1 ? values : values.get(0)));
return arguments;
}
@ -323,8 +323,8 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
.onErrorMap(InvalidEndpointRequestException.class,
(ex) -> new ResponseStatusException(HttpStatus.BAD_REQUEST,
ex.getReason()))
.defaultIfEmpty(new ResponseEntity<>(httpMethod == HttpMethod.GET
? HttpStatus.NOT_FOUND : HttpStatus.NO_CONTENT));
.defaultIfEmpty(new ResponseEntity<>(httpMethod != HttpMethod.GET
? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND));
}
private ResponseEntity<Object> toResponseEntity(Object response) {

@ -257,7 +257,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping
arguments.putAll(body);
}
request.getParameterMap().forEach((name, values) -> arguments.put(name,
values.length == 1 ? values[0] : Arrays.asList(values)));
values.length != 1 ? Arrays.asList(values) : values[0]));
return arguments;
}
@ -269,8 +269,8 @@ public abstract class AbstractWebMvcEndpointHandlerMapping
private Object handleResult(Object result, HttpMethod httpMethod) {
if (result == null) {
return new ResponseEntity<>(httpMethod == HttpMethod.GET
? HttpStatus.NOT_FOUND : HttpStatus.NO_CONTENT);
return new ResponseEntity<>(httpMethod != HttpMethod.GET
? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND);
}
if (!(result instanceof WebEndpointResponse)) {
return result;

@ -34,6 +34,7 @@ import org.springframework.boot.actuate.endpoint.annotation.Selector;
import org.springframework.boot.context.properties.bind.PlaceholdersResolver;
import org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver;
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
import org.springframework.boot.origin.Origin;
import org.springframework.boot.origin.OriginLookup;
import org.springframework.core.env.CompositePropertySource;
import org.springframework.core.env.ConfigurableEnvironment;
@ -152,11 +153,16 @@ public class EnvironmentEndpoint {
private PropertyValueDescriptor describeValueOf(String name, PropertySource<?> source,
PlaceholdersResolver resolver) {
Object resolved = resolver.resolvePlaceholders(source.getProperty(name));
String origin = (source instanceof OriginLookup)
? ((OriginLookup<Object>) source).getOrigin(name).toString() : null;
String origin = ((source instanceof OriginLookup)
? getOrigin((OriginLookup<Object>) source, name) : null);
return new PropertyValueDescriptor(sanitize(name, resolved), origin);
}
private String getOrigin(OriginLookup<Object> lookup, String name) {
Origin origin = lookup.getOrigin(name);
return (origin != null ? origin.toString() : null);
}
private PlaceholdersResolver getResolver() {
return new PropertySourcesPlaceholdersSanitizingResolver(getPropertySources(),
this.sanitizer);

@ -59,7 +59,7 @@ public class FlywayEndpoint {
.put(name, new FlywayDescriptor(flyway.info().all())));
ApplicationContext parent = target.getParent();
contextFlywayBeans.put(target.getId(), new ContextFlywayBeans(flywayBeans,
parent == null ? null : parent.getId()));
parent != null ? parent.getId() : null));
target = parent;
}
return new ApplicationFlywayBeans(contextFlywayBeans);
@ -170,7 +170,7 @@ public class FlywayEndpoint {
}
private String nullSafeToString(Object obj) {
return (obj == null ? null : obj.toString());
return (obj != null ? obj.toString() : null);
}
public MigrationType getType() {

@ -57,8 +57,8 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
Assert.notNull(indicators, "Indicators must not be null");
this.indicators = new LinkedHashMap<>(indicators);
this.healthAggregator = healthAggregator;
this.timeoutCompose = (mono) -> this.timeout != null ? mono.timeout(
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono;
this.timeoutCompose = (mono) -> (this.timeout != null ? mono.timeout(
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono);
}
/**

@ -86,7 +86,7 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator
super("DataSource health check failed");
this.dataSource = dataSource;
this.query = query;
this.jdbcTemplate = (dataSource == null ? null : new JdbcTemplate(dataSource));
this.jdbcTemplate = (dataSource != null ? new JdbcTemplate(dataSource) : null);
}
@Override

@ -69,7 +69,7 @@ public class LiquibaseEndpoint {
createReport(liquibase, service, factory)));
ApplicationContext parent = target.getParent();
contextBeans.put(target.getId(), new ContextLiquibaseBeans(liquibaseBeans,
parent == null ? null : parent.getId()));
parent != null ? parent.getId() : null));
target = parent;
}
return new ApplicationLiquibaseBeans(contextBeans);
@ -204,8 +204,8 @@ public class LiquibaseEndpoint {
this.execType = ranChangeSet.getExecType();
this.id = ranChangeSet.getId();
this.labels = ranChangeSet.getLabels().getLabels();
this.checksum = ranChangeSet.getLastCheckSum() == null ? null
: ranChangeSet.getLastCheckSum().toString();
this.checksum = (ranChangeSet.getLastCheckSum() != null
? ranChangeSet.getLastCheckSum().toString() : null);
this.orderExecuted = ranChangeSet.getOrderExecuted();
this.tag = ranChangeSet.getTag();
}

@ -73,7 +73,7 @@ public class LoggersEndpoint {
Assert.notNull(name, "Name must not be null");
LoggerConfiguration configuration = this.loggingSystem
.getLoggerConfiguration(name);
return (configuration == null ? null : new LoggerLevels(configuration));
return (configuration != null ? new LoggerLevels(configuration) : null);
}
@WriteOperation

@ -78,7 +78,7 @@ public class HeapDumpWebEndpoint {
if (this.lock.tryLock(this.timeout, TimeUnit.MILLISECONDS)) {
try {
return new WebEndpointResponse<>(
dumpHeap(live == null ? true : live));
dumpHeap(live != null ? live : true));
}
finally {
this.lock.unlock();

@ -96,10 +96,15 @@ public class MetricsEndpoint {
}
private List<Tag> parseTags(List<String> tags) {
return tags == null ? Collections.emptyList() : tags.stream().map((t) -> {
String[] tagParts = t.split(":", 2);
return Tag.of(tagParts[0], tagParts[1]);
}).collect(Collectors.toList());
if (tags == null) {
return Collections.emptyList();
}
return tags.stream().map(this::parseTag).collect(Collectors.toList());
}
private Tag parseTag(String tag) {
String[] parts = tag.split(":", 2);
return Tag.of(parts[0], parts[1]);
}
private void collectMeters(List<Meter> meters, MeterRegistry registry, String name,
@ -125,7 +130,7 @@ public class MetricsEndpoint {
}
private BiFunction<Double, Double, Double> mergeFunction(Statistic statistic) {
return Statistic.MAX.equals(statistic) ? Double::max : Double::sum;
return (Statistic.MAX.equals(statistic) ? Double::max : Double::sum);
}
private Map<String, Set<String>> getAvailableTags(List<Meter> meters) {

@ -50,10 +50,10 @@ public class PrometheusScrapeEndpoint {
TextFormat.write004(writer, this.collectorRegistry.metricFamilySamples());
return writer.toString();
}
catch (IOException e) {
catch (IOException ex) {
// This actually never happens since StringWriter::write() doesn't throw any
// IOException
throw new RuntimeException("Writing metrics failed", e);
throw new RuntimeException("Writing metrics failed", ex);
}
}

@ -36,9 +36,9 @@ public class DefaultRestTemplateExchangeTagsProvider
@Override
public Iterable<Tag> getTags(String urlTemplate, HttpRequest request,
ClientHttpResponse response) {
Tag uriTag = StringUtils.hasText(urlTemplate)
Tag uriTag = (StringUtils.hasText(urlTemplate)
? RestTemplateExchangeTags.uri(urlTemplate)
: RestTemplateExchangeTags.uri(request);
: RestTemplateExchangeTags.uri(request));
return Arrays.asList(RestTemplateExchangeTags.method(request), uriTag,
RestTemplateExchangeTags.status(response),
RestTemplateExchangeTags.clientName(request));

@ -64,7 +64,7 @@ public final class RestTemplateExchangeTags {
* @return the uri tag
*/
public static Tag uri(String uriTemplate) {
String uri = StringUtils.hasText(uriTemplate) ? uriTemplate : "none";
String uri = (StringUtils.hasText(uriTemplate) ? uriTemplate : "none");
return Tag.of("uri", ensureLeadingSlash(stripUri(uri)));
}

@ -58,7 +58,7 @@ public final class WebMvcTags {
* @return the method tag whose value is a capitalized method (e.g. GET).
*/
public static Tag method(HttpServletRequest request) {
return (request == null ? METHOD_UNKNOWN : Tag.of("method", request.getMethod()));
return (request != null ? Tag.of("method", request.getMethod()) : METHOD_UNKNOWN);
}
/**
@ -67,8 +67,9 @@ public final class WebMvcTags {
* @return the status tag derived from the status of the response
*/
public static Tag status(HttpServletResponse response) {
return (response == null ? STATUS_UNKNOWN :
Tag.of("status", Integer.toString(response.getStatus())));
return (response != null
? Tag.of("status", Integer.toString(response.getStatus()))
: STATUS_UNKNOWN);
}
/**

@ -86,7 +86,7 @@ public class HttpExchangeTracer {
}
private <T> T getIfIncluded(Include include, Supplier<T> valueSupplier) {
return this.includes.contains(include) ? valueSupplier.get() : null;
return (this.includes.contains(include) ? valueSupplier.get() : null);
}
private <T> void setIfIncluded(Include include, Supplier<T> supplier,

@ -59,8 +59,8 @@ public class MappingsEndpoint {
this.descriptionProviders
.forEach((provider) -> mappings.put(provider.getMappingName(),
provider.describeMappings(applicationContext)));
return new ContextMappings(mappings, applicationContext.getParent() == null ? null
: applicationContext.getId());
return new ContextMappings(mappings, applicationContext.getParent() != null
? applicationContext.getId() : null);
}
/**

@ -64,7 +64,7 @@ final class DispatcherServletHandlerMappings {
initializeDispatcherServletIfPossible();
handlerMappings = this.dispatcherServlet.getHandlerMappings();
}
return handlerMappings == null ? Collections.emptyList() : handlerMappings;
return (handlerMappings != null ? handlerMappings : Collections.emptyList());
}
private void initializeDispatcherServletIfPossible() {

@ -73,11 +73,11 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
@Override
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
Mono<?> principal = this.includes.contains(Include.PRINCIPAL)
Mono<?> principal = (this.includes.contains(Include.PRINCIPAL)
? exchange.getPrincipal().cast(Object.class).defaultIfEmpty(NONE)
: Mono.just(NONE);
Mono<?> session = this.includes.contains(Include.SESSION_ID)
? exchange.getSession() : Mono.just(NONE);
: Mono.just(NONE));
Mono<?> session = (this.includes.contains(Include.SESSION_ID)
? exchange.getSession() : Mono.just(NONE));
return Mono.zip(principal, session)
.flatMap((tuple) -> filter(exchange, chain,
asType(tuple.getT1(), Principal.class),
@ -97,17 +97,17 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
exchange);
HttpTrace trace = this.tracer.receivedRequest(request);
return chain.filter(exchange).doAfterSuccessOrError((aVoid, ex) -> {
this.tracer.sendingResponse(trace,
new TraceableServerHttpResponse(ex == null ? exchange.getResponse()
: new CustomStatusResponseDecorator(ex,
exchange.getResponse())),
() -> principal, () -> getStartedSessionId(session));
TraceableServerHttpResponse response = new TraceableServerHttpResponse(
(ex != null ? new CustomStatusResponseDecorator(ex,
exchange.getResponse()) : exchange.getResponse()));
this.tracer.sendingResponse(trace, response, () -> principal,
() -> getStartedSessionId(session));
this.repository.add(trace);
});
}
private String getStartedSessionId(WebSession session) {
return (session != null && session.isStarted()) ? session.getId() : null;
return (session != null && session.isStarted() ? session.getId() : null);
}
private static final class CustomStatusResponseDecorator
@ -117,9 +117,9 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
private CustomStatusResponseDecorator(Throwable ex, ServerHttpResponse delegate) {
super(delegate);
this.status = ex instanceof ResponseStatusException
this.status = (ex instanceof ResponseStatusException
? ((ResponseStatusException) ex).getStatus()
: HttpStatus.INTERNAL_SERVER_ERROR;
: HttpStatus.INTERNAL_SERVER_ERROR);
}
@Override

@ -45,8 +45,8 @@ class ServerWebExchangeTraceableRequest implements TraceableRequest {
this.method = request.getMethodValue();
this.headers = request.getHeaders();
this.uri = request.getURI();
this.remoteAddress = request.getRemoteAddress() == null ? null
: request.getRemoteAddress().getAddress().toString();
this.remoteAddress = (request.getRemoteAddress() != null
? request.getRemoteAddress().getAddress().toString() : null);
}
@Override

@ -38,8 +38,8 @@ class TraceableServerHttpResponse implements TraceableResponse {
@Override
public int getStatus() {
return this.response.getStatusCode() == null ? 200
: this.response.getStatusCode().value();
return (this.response.getStatusCode() != null
? this.response.getStatusCode().value() : 200);
}
@Override

@ -86,8 +86,9 @@ public class HttpTraceFilter extends OncePerRequestFilter implements Ordered {
}
finally {
TraceableHttpServletResponse traceableResponse = new TraceableHttpServletResponse(
status == response.getStatus() ? response
: new CustomStatusResponseWrapper(response, status));
status != response.getStatus()
? new CustomStatusResponseWrapper(response, status)
: response);
this.tracer.sendingResponse(trace, traceableResponse,
request::getUserPrincipal, () -> getSessionId(request));
this.repository.add(trace);
@ -96,7 +97,7 @@ public class HttpTraceFilter extends OncePerRequestFilter implements Ordered {
private String getSessionId(HttpServletRequest request) {
HttpSession session = request.getSession(false);
return session == null ? null : session.getId();
return (session != null ? session.getId() : null);
}
private static final class CustomStatusResponseWrapper

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

@ -57,7 +57,7 @@ public class ReflectiveOperationInvokerTests {
ReflectionUtils.findMethod(Example.class, "reverse", String.class),
OperationType.READ);
this.parameterValueMapper = (parameter,
value) -> (value == null ? null : value.toString());
value) -> (value != null ? value.toString() : null);
}
@Test

@ -190,8 +190,9 @@ public class JmxEndpointExporterTests {
@Override
public ObjectName getObjectName(ExposableJmxEndpoint endpoint)
throws MalformedObjectNameException {
return (endpoint == null ? null
: new ObjectName("boot:type=Endpoint,name=" + endpoint.getId()));
return (endpoint != null
? new ObjectName("boot:type=Endpoint,name=" + endpoint.getId())
: null);
}
}

@ -68,8 +68,8 @@ public class TestJmxOperation implements JmxOperation {
@Override
public Object invoke(InvocationContext context) {
return (this.invoke == null ? "result"
: this.invoke.apply(context.getArguments()));
return (this.invoke != null ? this.invoke.apply(context.getArguments())
: "result");
}
@Override

@ -835,7 +835,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
@ReadOperation
public String read(@Nullable Principal principal) {
return principal == null ? "None" : principal.getName();
return (principal != null ? principal.getName() : "None");
}
}
@ -856,7 +856,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
@ReadOperation
public String read(SecurityContext securityContext) {
Principal principal = securityContext.getPrincipal();
return principal == null ? "None" : principal.getName();
return (principal != null ? principal.getName() : "None");
}
}

@ -250,8 +250,8 @@ public class WebMvcMetricsFilterTests {
result.set(this.mvc.perform(get("/api/c1/completableFuture/{id}", 1))
.andExpect(request().asyncStarted()).andReturn());
}
catch (Exception e) {
fail("Failed to execute async request", e);
catch (Exception ex) {
fail("Failed to execute async request", ex);
}
});
backgroundRequest.start();

@ -326,8 +326,8 @@ public class HttpExchangeTracerTests {
private String mixedCase(String input) {
StringBuilder output = new StringBuilder();
for (int i = 0; i < input.length(); i++) {
output.append(i % 2 == 0 ? Character.toLowerCase(input.charAt(i))
: Character.toUpperCase(input.charAt(i)));
output.append(i % 2 != 0 ? Character.toUpperCase(input.charAt(i))
: Character.toLowerCase(input.charAt(i)));
}
return output.toString();
}

@ -157,7 +157,7 @@ public class FlywayAutoConfiguration {
private String getProperty(Supplier<String> property,
Supplier<String> defaultValue) {
String value = property.get();
return (value == null ? defaultValue.get() : value);
return (value != null ? value : defaultValue.get());
}
private void checkLocationExists(String... locations) {

@ -56,9 +56,9 @@ class IntegrationAutoConfigurationScanRegistrar extends IntegrationComponentScan
@Override
protected Collection<String> getBasePackages(
AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
return AutoConfigurationPackages.has(this.beanFactory)
return (AutoConfigurationPackages.has(this.beanFactory)
? AutoConfigurationPackages.get(this.beanFactory)
: Collections.emptyList();
: Collections.emptyList());
}
@IntegrationComponentScan

@ -234,8 +234,8 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
}
if (!StringUtils.hasText(driverClassName)) {
throw new DataSourceBeanCreationException(
"Failed to determine a suitable driver class",
this, this.embeddedDatabaseConnection);
"Failed to determine a suitable driver class", this,
this.embeddedDatabaseConnection);
}
return driverClassName;
}
@ -277,12 +277,12 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
return this.url;
}
String databaseName = determineDatabaseName();
String url = (databaseName == null ? null
: this.embeddedDatabaseConnection.getUrl(databaseName));
String url = (databaseName != null
? this.embeddedDatabaseConnection.getUrl(databaseName) : null);
if (!StringUtils.hasText(url)) {
throw new DataSourceBeanCreationException(
"Failed to determine suitable jdbc url",
this, this.embeddedDatabaseConnection);
"Failed to determine suitable jdbc url", this,
this.embeddedDatabaseConnection);
}
return url;
}

@ -168,7 +168,7 @@ public class LiquibaseAutoConfiguration {
private String getProperty(Supplier<String> property,
Supplier<String> defaultValue) {
String value = property.get();
return value == null ? defaultValue.get() : value;
return (value != null ? value : defaultValue.get());
}
}

@ -81,8 +81,8 @@ public class MongoClientFactory {
if (options == null) {
options = MongoClientOptions.builder().build();
}
String host = this.properties.getHost() == null ? "localhost"
: this.properties.getHost();
String host = (this.properties.getHost() != null ? this.properties.getHost()
: "localhost");
return new MongoClient(Collections.singletonList(new ServerAddress(host, port)),
options);
}
@ -101,8 +101,8 @@ public class MongoClientFactory {
int port = getValue(properties.getPort(), MongoProperties.DEFAULT_PORT);
List<ServerAddress> seeds = Collections
.singletonList(new ServerAddress(host, port));
return credentials == null ? new MongoClient(seeds, options)
: new MongoClient(seeds, credentials, options);
return (credentials != null ? new MongoClient(seeds, credentials, options)
: new MongoClient(seeds, options));
}
return createMongoClient(MongoProperties.DEFAULT_URI, options);
}
@ -112,7 +112,7 @@ public class MongoClientFactory {
}
private <T> T getValue(T value, T fallback) {
return (value == null ? fallback : value);
return (value != null ? value : fallback);
}
private boolean hasCustomAddress() {

@ -86,8 +86,8 @@ public class ReactiveMongoClientFactory {
private MongoClient createEmbeddedMongoClient(MongoClientSettings settings,
int port) {
Builder builder = builder(settings);
String host = this.properties.getHost() == null ? "localhost"
: this.properties.getHost();
String host = (this.properties.getHost() != null ? this.properties.getHost()
: "localhost");
ClusterSettings clusterSettings = ClusterSettings.builder()
.hosts(Collections.singletonList(new ServerAddress(host, port))).build();
builder.clusterSettings(clusterSettings);
@ -119,16 +119,16 @@ public class ReactiveMongoClientFactory {
}
private void applyCredentials(Builder builder) {
String database = this.properties.getAuthenticationDatabase() == null
? this.properties.getMongoClientDatabase()
: this.properties.getAuthenticationDatabase();
String database = (this.properties.getAuthenticationDatabase() != null
? this.properties.getAuthenticationDatabase()
: this.properties.getMongoClientDatabase());
builder.credential((MongoCredential.createCredential(
this.properties.getUsername(), database, this.properties.getPassword())));
}
private <T> T getOrDefault(T value, T defaultValue) {
return (value == null ? defaultValue : value);
return (value != null ? value : defaultValue);
}
private MongoClient createMongoClient(Builder builder) {

@ -91,8 +91,8 @@ class DataSourceInitializedPublisher implements BeanPostProcessor {
if (this.properties == null) {
return true; // better safe than sorry
}
Supplier<String> defaultDdlAuto = () -> EmbeddedDatabaseConnection
.isEmbedded(dataSource) ? "create-drop" : "none";
Supplier<String> defaultDdlAuto = () -> (EmbeddedDatabaseConnection
.isEmbedded(dataSource) ? "create-drop" : "none");
Map<String, Object> hibernate = this.properties
.getHibernateProperties(new HibernateSettings().ddlAuto(defaultDdlAuto));
if (hibernate.containsKey("hibernate.hbm2ddl.auto")) {

@ -72,8 +72,8 @@ final class OAuth2ClientPropertiesRegistrationAdapter {
private static Builder getBuilder(String registrationId, String configuredProviderId,
Map<String, Provider> providers) {
String providerId = (configuredProviderId == null ? registrationId
: configuredProviderId);
String providerId = (configuredProviderId != null ? configuredProviderId
: registrationId);
CommonOAuth2Provider provider = getCommonProvider(providerId);
if (provider == null && !providers.containsKey(providerId)) {
throw new IllegalStateException(
@ -89,10 +89,10 @@ final class OAuth2ClientPropertiesRegistrationAdapter {
private static String getErrorMessage(String configuredProviderId,
String registrationId) {
return (configuredProviderId == null
? "Provider ID must be specified for client registration '"
+ registrationId + "'"
: "Unknown provider ID '" + configuredProviderId + "'");
return (configuredProviderId != null
? "Unknown provider ID '" + configuredProviderId + "'"
: "Provider ID must be specified for client registration '"
+ registrationId + "'");
}
private static Builder getBuilder(Builder builder, Provider provider) {

@ -93,7 +93,7 @@ final class SessionStoreMappings {
}
private String getName(Class<?> configuration) {
return (configuration == null ? null : configuration.getName());
return (configuration != null ? configuration.getName() : null);
}
}

@ -36,8 +36,8 @@ public class TransactionManagerCustomizers {
public TransactionManagerCustomizers(
Collection<? extends PlatformTransactionManagerCustomizer<?>> customizers) {
this.customizers = (customizers == null ? Collections.emptyList()
: new ArrayList<>(customizers));
this.customizers = (customizers != null ? new ArrayList<>(customizers)
: Collections.emptyList());
}
@SuppressWarnings("unchecked")

@ -110,9 +110,9 @@ public class TomcatWebServerFactoryCustomizer implements
}
private int determineMaxHttpHeaderSize() {
return this.serverProperties.getMaxHttpHeaderSize() > 0
return (this.serverProperties.getMaxHttpHeaderSize() > 0
? this.serverProperties.getMaxHttpHeaderSize()
: this.serverProperties.getTomcat().getMaxHttpHeaderSize();
: this.serverProperties.getTomcat().getMaxHttpHeaderSize());
}
private void customizeAcceptCount(ConfigurableTomcatWebServerFactory factory,

@ -205,7 +205,7 @@ public abstract class AbstractErrorWebExceptionHandler
}
private String htmlEscape(Object input) {
return (input == null ? null : HtmlUtils.htmlEscape(input.toString()));
return (input != null ? HtmlUtils.htmlEscape(input.toString()) : null);
}
@Override

@ -338,7 +338,7 @@ public class WebMvcAutoConfiguration {
}
private Integer getSeconds(Duration cachePeriod) {
return (cachePeriod == null ? null : (int) cachePeriod.getSeconds());
return (cachePeriod != null ? (int) cachePeriod.getSeconds() : null);
}
@Bean

@ -146,7 +146,7 @@ public class WebServicesAutoConfiguration {
return this.applicationContext
.getResources(ensureTrailingSlash(location) + pattern);
}
catch (IOException e) {
catch (IOException ex) {
return new Resource[0];
}
}

@ -102,7 +102,7 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
String[] dependsOn = ((BeanDefinitionRegistry) context
.getSourceApplicationContext()).getBeanDefinition("entityManagerFactory")
.getDependsOn();
return dependsOn != null ? Arrays.asList(dependsOn) : Collections.emptyList();
return (dependsOn != null ? Arrays.asList(dependsOn) : Collections.emptyList());
}
@Configuration

@ -101,7 +101,7 @@ public class JooqPropertiesTests {
given(connection.getMetaData()).willReturn(metadata);
given(ds.getConnection()).willReturn(connection);
}
catch (SQLException e) {
catch (SQLException ex) {
// Do nothing
}
return ds;

@ -136,7 +136,7 @@ public class CustomHibernateJpaAutoConfigurationTests {
given(dataSource.getConnection().getMetaData())
.willReturn(mock(DatabaseMetaData.class));
}
catch (SQLException e) {
catch (SQLException ex) {
// Do nothing
}
return dataSource;

@ -307,7 +307,7 @@ public class JpaPropertiesTests {
given(connection.getMetaData()).willReturn(metadata);
given(ds.getConnection()).willReturn(connection);
}
catch (SQLException e) {
catch (SQLException ex) {
// Do nothing
}
return ds;

@ -52,15 +52,17 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
}
public ServletContext getServletContext() {
return getWebServer() == null ? null : getWebServer().getServletContext();
return (getWebServer() != null ? getWebServer().getServletContext() : null);
}
public RegisteredServlet getRegisteredServlet(int index) {
return getWebServer() == null ? null : getWebServer().getRegisteredServlet(index);
return (getWebServer() != null ? getWebServer().getRegisteredServlet(index)
: null);
}
public RegisteredFilter getRegisteredFilter(int index) {
return getWebServer() == null ? null : getWebServer().getRegisteredFilters(index);
return (getWebServer() != null ? getWebServer().getRegisteredFilters(index)
: null);
}
public static class MockServletWebServer

@ -130,7 +130,7 @@ public class SourceOptions {
}
private String asString(Object arg) {
return (arg == null ? null : String.valueOf(arg));
return (arg != null ? String.valueOf(arg) : null);
}
public List<String> getSources() {

@ -154,7 +154,7 @@ public class CliTester implements TestRule {
}
}
else {
sources[i] = new File(arg).isAbsolute() ? arg : this.prefix + arg;
sources[i] = (new File(arg).isAbsolute() ? arg : this.prefix + arg);
}
}
return sources;

@ -56,7 +56,7 @@ public class ClassLoaderFile implements Serializable {
public ClassLoaderFile(Kind kind, long lastModified, byte[] contents) {
Assert.notNull(kind, "Kind must not be null");
Assert.isTrue(kind != Kind.DELETED ? contents != null : contents == null,
() -> "Contents must " + (kind == Kind.DELETED ? "" : "not ")
() -> "Contents must " + (kind != Kind.DELETED ? "not " : "")
+ "be null");
this.kind = kind;
this.lastModified = lastModified;

@ -119,7 +119,7 @@ public class MockClientHttpRequestFactory implements ClientHttpRequestFactory {
public ClientHttpResponse asHttpResponse(AtomicLong seq) {
MockClientHttpResponse httpResponse = new MockClientHttpResponse(
this.payload == null ? NO_DATA : this.payload, this.status);
this.payload != null ? this.payload : NO_DATA, this.status);
waitForDelay();
if (this.payload != null) {
httpResponse.getHeaders().setContentLength(this.payload.length);

@ -148,7 +148,7 @@ class PropertiesMigrationReport {
}
private <T> List<T> asNewList(List<T> source) {
return (source == null ? Collections.emptyList() : new ArrayList<>(source));
return (source != null ? new ArrayList<>(source) : Collections.emptyList());
}
public List<PropertyMigration> getRenamed() {

@ -278,8 +278,8 @@ public class ApplicationContextAssert<C extends ApplicationContext>
"%nExpecting:%n <%s>%nsingle bean of type:%n <%s>%nbut found:%n <%s>",
getApplicationContext(), type, names));
}
T bean = (names.length == 0 ? null
: getApplicationContext().getBean(names[0], type));
T bean = (names.length != 0 ? getApplicationContext().getBean(names[0], type)
: null);
return Assertions.assertThat(bean).as("Bean of type <%s> from <%s>", type,
getApplicationContext());
}

@ -93,11 +93,11 @@ public final class WebApplicationContextRunner extends
*/
public static Supplier<ConfigurableWebApplicationContext> withMockServletContext(
Supplier<ConfigurableWebApplicationContext> contextFactory) {
return (contextFactory == null ? null : () -> {
return (contextFactory != null ? () -> {
ConfigurableWebApplicationContext context = contextFactory.get();
context.setServletContext(new MockServletContext());
return context;
});
} : null);
}
}

@ -235,7 +235,7 @@ public final class TestPropertyValues {
}
protected String applySuffix(String name) {
return (this.suffix == null ? name : name + "-" + this.suffix);
return (this.suffix != null ? name + "-" + this.suffix : name);
}
}

@ -130,7 +130,7 @@ public class TestRestTemplate {
*/
public TestRestTemplate(RestTemplateBuilder restTemplateBuilder, String username,
String password, HttpClientOption... httpClientOptions) {
this(restTemplateBuilder == null ? null : restTemplateBuilder.build(), username,
this(restTemplateBuilder != null ? restTemplateBuilder.build() : null, username,
password, httpClientOptions);
}
@ -138,8 +138,8 @@ public class TestRestTemplate {
HttpClientOption... httpClientOptions) {
Assert.notNull(restTemplate, "RestTemplate must not be null");
this.httpClientOptions = httpClientOptions;
if (getRequestFactoryClass(restTemplate).isAssignableFrom(
HttpComponentsClientHttpRequestFactory.class)) {
if (getRequestFactoryClass(restTemplate)
.isAssignableFrom(HttpComponentsClientHttpRequestFactory.class)) {
restTemplate.setRequestFactory(
new CustomHttpComponentsClientHttpRequestFactory(httpClientOptions));
}

@ -158,7 +158,7 @@ public abstract class AbstractApplicationContextRunnerTests<T extends AbstractAp
context.getClassLoader());
fail("Should have thrown a ClassNotFoundException");
}
catch (ClassNotFoundException e) {
catch (ClassNotFoundException ex) {
// expected
}
});

@ -423,7 +423,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
this.metadataCollector.add(ItemMetadata.newProperty(endpointKey, "enabled",
Boolean.class.getName(), type, null,
String.format("Whether to enable the %s endpoint.", endpointId),
(enabledByDefault == null ? true : enabledByDefault), null));
(enabledByDefault != null ? enabledByDefault : true), null));
if (hasMainReadOperation(element)) {
this.metadataCollector.add(ItemMetadata.newProperty(endpointKey,
"cache.time-to-live", Duration.class.getName(), type, null,

@ -178,7 +178,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser {
String type = instance.toString();
type = type.substring(DURATION_OF.length(), type.indexOf('('));
String suffix = DURATION_SUFFIX.get(type);
return (suffix == null ? null : factoryValue + suffix);
return (suffix != null ? factoryValue + suffix : null);
}
return factoryValue;
}

@ -119,7 +119,7 @@ public class SpringBootExtension {
private String determineArtifactBaseName() {
Jar artifactTask = findArtifactTask();
return (artifactTask == null ? null : artifactTask.getBaseName());
return (artifactTask != null ? artifactTask.getBaseName() : null);
}
private Jar findArtifactTask() {

@ -162,9 +162,9 @@ final class JavaPluginAction implements PluginApplicationAction {
}
private boolean hasConfigurationProcessorOnClasspath(JavaCompile compile) {
Set<File> files = compile.getOptions().getAnnotationProcessorPath() != null
Set<File> files = (compile.getOptions().getAnnotationProcessorPath() != null
? compile.getOptions().getAnnotationProcessorPath().getFiles()
: compile.getClasspath().getFiles();
: compile.getClasspath().getFiles());
return files.stream().map(File::getName).anyMatch(
(name) -> name.startsWith("spring-boot-configuration-processor"));
}

@ -57,9 +57,9 @@ public class BuildInfo extends ConventionTask {
new File(getDestinationDir(), "build-info.properties"))
.writeBuildProperties(new ProjectDetails(
this.properties.getGroup(),
this.properties.getArtifact() == null
? "unspecified"
: this.properties.getArtifact(),
this.properties.getArtifact() != null
? this.properties.getArtifact()
: "unspecified",
this.properties.getVersion(),
this.properties.getName(), this.properties.getTime(),
coerceToStringValues(
@ -77,8 +77,8 @@ public class BuildInfo extends ConventionTask {
*/
@OutputDirectory
public File getDestinationDir() {
return this.destinationDir != null ? this.destinationDir
: getProject().getBuildDir();
return (this.destinationDir != null ? this.destinationDir
: getProject().getBuildDir());
}
/**

@ -54,8 +54,8 @@ public class BootJar extends Jar implements BootArchive {
private Action<CopySpec> classpathFiles(Spec<File> filter) {
return (copySpec) -> copySpec
.from((Callable<Iterable<File>>) () -> this.classpath == null
? Collections.emptyList() : this.classpath.filter(filter));
.from((Callable<Iterable<File>>) () -> (this.classpath != null
? this.classpath.filter(filter) : Collections.emptyList()));
}
@ -114,7 +114,7 @@ public class BootJar extends Jar implements BootArchive {
public void classpath(Object... classpath) {
FileCollection existingClasspath = this.classpath;
this.classpath = getProject().files(
existingClasspath == null ? Collections.emptyList() : existingClasspath,
existingClasspath != null ? existingClasspath : Collections.emptyList(),
classpath);
}

@ -51,8 +51,8 @@ public class BootWar extends War implements BootArchive {
public BootWar() {
getWebInf().into("lib-provided",
(copySpec) -> copySpec.from(
(Callable<Iterable<File>>) () -> this.providedClasspath == null
? Collections.emptyList() : this.providedClasspath));
(Callable<Iterable<File>>) () -> (this.providedClasspath != null
? this.providedClasspath : Collections.emptyList())));
}
@Override
@ -120,7 +120,7 @@ public class BootWar extends War implements BootArchive {
public void providedClasspath(Object... classpath) {
FileCollection existingClasspath = this.providedClasspath;
this.providedClasspath = getProject().files(
existingClasspath == null ? Collections.emptyList() : existingClasspath,
existingClasspath != null ? existingClasspath : Collections.emptyList(),
classpath);
}

@ -284,8 +284,8 @@ class BootZipCopyAction implements CopyAction {
}
private long getTime(FileCopyDetails details) {
return this.preserveFileTimestamps ? details.getLastModified()
: CONSTANT_TIME_FOR_ZIP_ENTRIES;
return (this.preserveFileTimestamps ? details.getLastModified()
: CONSTANT_TIME_FOR_ZIP_ENTRIES);
}
}

@ -141,7 +141,7 @@ final class AsciiBytes {
public boolean matches(CharSequence name, char suffix) {
int charIndex = 0;
int nameLen = name.length();
int totalLen = (nameLen + (suffix == 0 ? 0 : 1));
int totalLen = (nameLen + (suffix != 0 ? 1 : 0));
for (int i = this.offset; i < this.offset + this.length; i++) {
int b = this.bytes[i];
int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
@ -250,7 +250,7 @@ final class AsciiBytes {
}
public static int hashCode(int hash, char suffix) {
return (suffix == 0 ? hash : (31 * hash + suffix));
return (suffix != 0 ? (31 * hash + suffix) : hash);
}
}

@ -120,7 +120,7 @@ public class JarFile extends java.util.jar.JarFile {
parser.addVisitor(centralDirectoryVisitor());
this.data = parser.parse(data, filter == null);
this.type = type;
this.manifestSupplier = manifestSupplier != null ? manifestSupplier : () -> {
this.manifestSupplier = (manifestSupplier != null ? manifestSupplier : () -> {
try (InputStream inputStream = getInputStream(MANIFEST_NAME)) {
if (inputStream == null) {
return null;
@ -130,7 +130,7 @@ public class JarFile extends java.util.jar.JarFile {
catch (IOException ex) {
throw new RuntimeException(ex);
}
};
});
}
private CentralDirectoryVisitor centralDirectoryVisitor() {

@ -36,7 +36,7 @@ final class StringSequence implements CharSequence {
private int hash;
StringSequence(String source) {
this(source, 0, (source == null ? -1 : source.length()));
this(source, 0, source != null ? source.length() : -1);
}
StringSequence(String source, int start, int end) {

@ -68,7 +68,7 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer
private void process(String name, String value) {
String existing = this.data.getProperty(name);
this.data.setProperty(name, (existing == null ? value : existing + "," + value));
this.data.setProperty(name, (existing != null ? existing + "," + value : value));
}
@Override

@ -64,7 +64,7 @@ class Container implements TestRule {
try {
DockerClientFactory.instance().client();
}
catch (Throwable t) {
catch (Throwable ex) {
return new SkipStatement();
}
this.container = this.containerFactory.get();

@ -62,8 +62,8 @@ public class Neo4jContainer extends Container {
Unreliables.retryUntilTrue((int) this.startupTimeout.getSeconds(),
TimeUnit.SECONDS, checkConnection(sessionFactory));
}
catch (TimeoutException e) {
throw new IllegalStateException();
catch (TimeoutException ex) {
throw new IllegalStateException(ex);
}
}

@ -161,9 +161,9 @@ public class ImageBanner implements Banner {
IIOMetadataNode root = (IIOMetadataNode) metadata
.getAsTree(metadata.getNativeMetadataFormatName());
IIOMetadataNode extension = findNode(root, "GraphicControlExtension");
String attribute = (extension == null ? null
: extension.getAttribute("delayTime"));
return (attribute == null ? 0 : Integer.parseInt(attribute) * 10);
String attribute = (extension != null ? extension.getAttribute("delayTime")
: null);
return (attribute != null ? Integer.parseInt(attribute) * 10 : 0);
}
private static IIOMetadataNode findNode(IIOMetadataNode rootNode, String nodeName) {

@ -961,8 +961,8 @@ public class SpringApplication {
*/
@Deprecated
public void setWebEnvironment(boolean webEnvironment) {
this.webApplicationType = webEnvironment ? WebApplicationType.SERVLET
: WebApplicationType.NONE;
this.webApplicationType = (webEnvironment ? WebApplicationType.SERVLET
: WebApplicationType.NONE);
}
/**

@ -66,7 +66,7 @@ public class ContextIdApplicationContextInitializer implements
private String getApplicationId(ConfigurableEnvironment environment) {
String name = environment.getProperty("spring.application.name");
return StringUtils.hasText(name) ? name : "application";
return (StringUtils.hasText(name) ? name : "application");
}
/**

@ -313,8 +313,8 @@ public class ConfigFileApplicationListener
Loader(ConfigurableEnvironment environment, ResourceLoader resourceLoader) {
this.environment = environment;
this.resourceLoader = resourceLoader == null ? new DefaultResourceLoader()
: resourceLoader;
this.resourceLoader = (resourceLoader != null ? resourceLoader
: new DefaultResourceLoader());
this.propertySourceLoaders = SpringFactoriesLoader.loadFactories(
PropertySourceLoader.class, getClass().getClassLoader());
}

@ -98,8 +98,9 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc
private void bind(Object bean, String beanName, ConfigurationProperties annotation) {
ResolvableType type = getBeanType(bean, beanName);
Validated validated = getAnnotation(bean, beanName, Validated.class);
Annotation[] annotations = (validated == null ? new Annotation[] { annotation }
: new Annotation[] { annotation, validated });
Annotation[] annotations = (validated != null
? new Annotation[] { annotation, validated }
: new Annotation[] { annotation });
Bindable<?> target = Bindable.of(type).withExistingValue(bean)
.withAnnotations(annotations);
try {

@ -75,8 +75,8 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector {
MultiValueMap<String, Object> attributes = metadata
.getAllAnnotationAttributes(
EnableConfigurationProperties.class.getName(), false);
return collectClasses(attributes == null ? Collections.emptyList()
: attributes.get("value"));
return collectClasses(attributes != null ? attributes.get("value")
: Collections.emptyList());
}
private List<Class<?>> collectClasses(List<?> values) {

@ -77,7 +77,7 @@ public class BindException extends RuntimeException implements OriginProvider {
Bindable<?> target) {
StringBuilder message = new StringBuilder();
message.append("Failed to bind properties");
message.append(name == null ? "" : " under '" + name + "'");
message.append(name != null ? " under '" + name + "'" : "");
message.append(" to ").append(target.getType());
return message.toString();
}

@ -89,7 +89,7 @@ public final class BindResult<T> {
*/
public <U> BindResult<U> map(Function<? super T, ? extends U> mapper) {
Assert.notNull(mapper, "Mapper must not be null");
return of(this.value == null ? null : mapper.apply(this.value));
return of(this.value != null ? mapper.apply(this.value) : null);
}
/**

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

Loading…
Cancel
Save