Skip to content

Commit 41efea5

Browse files
committed
Polish ternary expressions
Consistently format ternary expressions and always favor `!=` as the the check.
1 parent bbf94c2 commit 41efea5

File tree

128 files changed

+285
-257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+285
-257
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebEndpointDiscoverer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private boolean isHealthEndpointExtension(Object extensionBean) {
7272
AnnotationAttributes attributes = AnnotatedElementUtils
7373
.getMergedAnnotationAttributes(extensionBean.getClass(),
7474
EndpointWebExtension.class);
75-
Class<?> endpoint = (attributes == null ? null : attributes.getClass("endpoint"));
75+
Class<?> endpoint = (attributes != null ? attributes.getClass("endpoint") : null);
7676
return (endpoint != null && HealthEndpoint.class.isAssignableFrom(endpoint));
7777
}
7878

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfiguration.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,8 @@ private ReactiveCloudFoundrySecurityService getCloudFoundrySecurityService(
126126
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
127127
boolean skipSslValidation = environment.getProperty(
128128
"management.cloudfoundry.skip-ssl-validation", Boolean.class, false);
129-
return (cloudControllerUrl == null ? null
130-
: new ReactiveCloudFoundrySecurityService(webClientBuilder,
131-
cloudControllerUrl, skipSslValidation));
129+
return (cloudControllerUrl != null ? new ReactiveCloudFoundrySecurityService(
130+
webClientBuilder, cloudControllerUrl, skipSslValidation) : null);
132131
}
133132

134133
private CorsConfiguration getCorsConfiguration() {

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ private CloudFoundrySecurityService getCloudFoundrySecurityService(
130130
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
131131
boolean skipSslValidation = environment.getProperty(
132132
"management.cloudfoundry.skip-ssl-validation", Boolean.class, false);
133-
return (cloudControllerUrl == null ? null : new CloudFoundrySecurityService(
134-
restTemplateBuilder, cloudControllerUrl, skipSslValidation));
133+
return (cloudControllerUrl != null ? new CloudFoundrySecurityService(
134+
restTemplateBuilder, cloudControllerUrl, skipSslValidation) : null);
135135
}
136136

137137
private CorsConfiguration getCorsConfiguration() {

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpoint.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ public ContextConditionEvaluation(ConfigurableApplicationContext context) {
125125
this.unconditionalClasses = report.getUnconditionalClasses();
126126
report.getConditionAndOutcomesBySource().forEach(
127127
(source, conditionAndOutcomes) -> add(source, conditionAndOutcomes));
128-
this.parentId = context.getParent() == null ? null
129-
: context.getParent().getId();
128+
this.parentId = (context.getParent() != null ? context.getParent().getId()
129+
: null);
130130
}
131131

132132
private void add(String source, ConditionAndOutcomes conditionAndOutcomes) {

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public HealthIndicator elasticsearchHealthIndicator() {
8282
protected ElasticsearchHealthIndicator createHealthIndicator(Client client) {
8383
Duration responseTimeout = this.properties.getResponseTimeout();
8484
return new ElasticsearchHealthIndicator(client,
85-
responseTimeout == null ? 100 : responseTimeout.toMillis(),
85+
responseTimeout != null ? responseTimeout.toMillis() : 100,
8686
this.properties.getIndices());
8787
}
8888

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorAutoConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected DataSourceHealthIndicator createHealthIndicator(DataSource source) {
112112
private String getValidationQuery(DataSource source) {
113113
DataSourcePoolMetadata poolMetadata = this.poolMetadataProvider
114114
.getDataSourcePoolMetadata(source);
115-
return (poolMetadata == null ? null : poolMetadata.getValidationQuery());
115+
return (poolMetadata != null ? poolMetadata.getValidationQuery() : null);
116116
}
117117

118118
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilter.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ public DistributionStatisticConfig configure(Meter.Id id,
6868
}
6969

7070
private long[] convertSla(Meter.Type meterType, ServiceLevelAgreementBoundary[] sla) {
71-
long[] converted = Arrays.stream(sla == null ? EMPTY_SLA : sla)
71+
long[] converted = Arrays.stream(sla != null ? sla : EMPTY_SLA)
7272
.map((candidate) -> candidate.getValue(meterType))
7373
.filter(Objects::nonNull).mapToLong(Long::longValue).toArray();
74-
return (converted.length == 0 ? null : converted);
74+
return (converted.length != 0 ? converted : null);
7575
}
7676

7777
private <T> T lookup(Map<String, T> values, Id id, T defaultValue) {
@@ -82,7 +82,7 @@ private <T> T lookup(Map<String, T> values, Id id, T defaultValue) {
8282
return result;
8383
}
8484
int lastDot = name.lastIndexOf('.');
85-
name = lastDot == -1 ? "" : name.substring(0, lastDot);
85+
name = (lastDot != -1 ? name.substring(0, lastDot) : "");
8686
}
8787
return values.getOrDefault("all", defaultValue);
8888
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public String globalPrefix() {
6060
}
6161

6262
private String getUriAsString(WavefrontProperties properties) {
63-
return properties.getUri() == null ? null : properties.getUri().toString();
63+
return (properties.getUri() != null ? properties.getUri().toString() : null);
6464
}
6565

6666
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class TomcatMetricsAutoConfiguration {
4747
@Bean
4848
@ConditionalOnMissingBean
4949
public TomcatMetrics tomcatMetrics() {
50-
return new TomcatMetrics(this.context == null ? null : this.context.getManager(),
50+
return new TomcatMetrics(this.context != null ? this.context.getManager() : null,
5151
Collections.emptyList());
5252
}
5353

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ private ManagementContextType readContextType(
125125
Map<String, Object> annotationAttributes = annotationMetadata
126126
.getAnnotationAttributes(
127127
ManagementContextConfiguration.class.getName());
128-
return (annotationAttributes == null ? ManagementContextType.ANY
129-
: (ManagementContextType) annotationAttributes.get("value"));
128+
return (annotationAttributes != null
129+
? (ManagementContextType) annotationAttributes.get("value")
130+
: ManagementContextType.ANY);
130131
}
131132

132133
private int readOrder(AnnotationMetadata annotationMetadata) {

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/MockServletWebServerFactory.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,17 @@ public MockServletWebServer getWebServer() {
5252
}
5353

5454
public ServletContext getServletContext() {
55-
return getWebServer() == null ? null : getWebServer().getServletContext();
55+
return (getWebServer() != null ? getWebServer().getServletContext() : null);
5656
}
5757

5858
public RegisteredServlet getRegisteredServlet(int index) {
59-
return getWebServer() == null ? null : getWebServer().getRegisteredServlet(index);
59+
return (getWebServer() != null ? getWebServer().getRegisteredServlet(index)
60+
: null);
6061
}
6162

6263
public RegisteredFilter getRegisteredFilter(int index) {
63-
return getWebServer() == null ? null : getWebServer().getRegisteredFilters(index);
64+
return (getWebServer() != null ? getWebServer().getRegisteredFilters(index)
65+
: null);
6466
}
6567

6668
public static class MockServletWebServer

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEventsEndpoint.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.boot.actuate.audit;
1818

19+
import java.time.Instant;
1920
import java.time.OffsetDateTime;
2021
import java.util.List;
2122

@@ -43,8 +44,13 @@ public AuditEventsEndpoint(AuditEventRepository auditEventRepository) {
4344
@ReadOperation
4445
public AuditEventsDescriptor events(@Nullable String principal,
4546
@Nullable OffsetDateTime after, @Nullable String type) {
46-
return new AuditEventsDescriptor(this.auditEventRepository.find(principal,
47-
after == null ? null : after.toInstant(), type));
47+
List<AuditEvent> events = this.auditEventRepository.find(principal,
48+
getInstant(after), type);
49+
return new AuditEventsDescriptor(events);
50+
}
51+
52+
private Instant getInstant(OffsetDateTime offsetDateTime) {
53+
return (offsetDateTime != null ? offsetDateTime.toInstant() : null);
4854
}
4955

5056
/**

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/beans/BeansEndpoint.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private static ContextBeans describing(ConfigurableApplicationContext context) {
119119
}
120120
ConfigurableApplicationContext parent = getConfigurableParent(context);
121121
return new ContextBeans(describeBeans(context.getBeanFactory()),
122-
parent == null ? null : parent.getId());
122+
parent != null ? parent.getId() : null);
123123
}
124124

125125
private static Map<String, BeanDescriptor> describeBeans(
@@ -168,8 +168,8 @@ public static final class BeanDescriptor {
168168
private BeanDescriptor(String[] aliases, String scope, Class<?> type,
169169
String resource, String[] dependencies) {
170170
this.aliases = aliases;
171-
this.scope = StringUtils.hasText(scope) ? scope
172-
: BeanDefinition.SCOPE_SINGLETON;
171+
this.scope = (StringUtils.hasText(scope) ? scope
172+
: BeanDefinition.SCOPE_SINGLETON);
173173
this.type = type;
174174
this.resource = resource;
175175
this.dependencies = dependencies;

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private ContextConfigurationProperties describeConfigurationProperties(
118118
prefix, sanitize(prefix, safeSerialize(mapper, bean, prefix))));
119119
});
120120
return new ContextConfigurationProperties(beanDescriptors,
121-
context.getParent() == null ? null : context.getParent().getId());
121+
context.getParent() != null ? context.getParent().getId() : null);
122122
}
123123

124124
private ConfigurationBeanFactoryMetadata getBeanFactoryMetadata(

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class ElasticsearchHealthIndicator extends AbstractHealthIndicator {
5555
public ElasticsearchHealthIndicator(Client client, long responseTimeout,
5656
List<String> indices) {
5757
this(client, responseTimeout,
58-
(indices == null ? null : StringUtils.toStringArray(indices)));
58+
(indices != null ? StringUtils.toStringArray(indices) : null));
5959
}
6060

6161
/**

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private void addOperations(MultiValueMap<OperationKey, O> indexed, String id,
224224
}
225225

226226
private <T> T getLast(List<T> list) {
227-
return CollectionUtils.isEmpty(list) ? null : list.get(list.size() - 1);
227+
return (CollectionUtils.isEmpty(list) ? null : list.get(list.size() - 1));
228228
}
229229

230230
private void assertNoDuplicateOperations(EndpointBean endpointBean,

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JacksonJmxOperationResponseMapper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class JacksonJmxOperationResponseMapper implements JmxOperationResponseMa
3939
private final JavaType mapType;
4040

4141
public JacksonJmxOperationResponseMapper(ObjectMapper objectMapper) {
42-
this.objectMapper = (objectMapper == null ? new ObjectMapper() : objectMapper);
42+
this.objectMapper = (objectMapper != null ? objectMapper : new ObjectMapper());
4343
this.listType = this.objectMapper.getTypeFactory()
4444
.constructParametricType(List.class, Object.class);
4545
this.mapType = this.objectMapper.getTypeFactory()

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMappedEndpoints.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
4646
*/
4747
public PathMappedEndpoints(String basePath, EndpointsSupplier<?> supplier) {
4848
Assert.notNull(supplier, "Supplier must not be null");
49-
this.basePath = (basePath == null ? "" : basePath);
49+
this.basePath = (basePath != null ? basePath : "");
5050
this.endpoints = getEndpoints(Collections.singleton(supplier));
5151
}
5252

@@ -58,7 +58,7 @@ public PathMappedEndpoints(String basePath, EndpointsSupplier<?> supplier) {
5858
public PathMappedEndpoints(String basePath,
5959
Collection<EndpointsSupplier<?>> suppliers) {
6060
Assert.notNull(suppliers, "Suppliers must not be null");
61-
this.basePath = (basePath == null ? "" : basePath);
61+
this.basePath = (basePath != null ? basePath : "");
6262
this.endpoints = getEndpoints(suppliers);
6363
}
6464

@@ -91,7 +91,7 @@ public String getBasePath() {
9191
*/
9292
public String getRootPath(String endpointId) {
9393
PathMappedEndpoint endpoint = getEndpoint(endpointId);
94-
return (endpoint == null ? null : endpoint.getRootPath());
94+
return (endpoint != null ? endpoint.getRootPath() : null);
9595
}
9696

9797
/**
@@ -144,7 +144,7 @@ public Iterator<PathMappedEndpoint> iterator() {
144144
}
145145

146146
private String getPath(PathMappedEndpoint endpoint) {
147-
return (endpoint == null ? null : this.basePath + "/" + endpoint.getRootPath());
147+
return (endpoint != null ? this.basePath + "/" + endpoint.getRootPath() : null);
148148
}
149149

150150
private <T> List<T> asList(Stream<T> stream) {

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class ServletEndpointRegistrar implements ServletContextInitializer {
4646
public ServletEndpointRegistrar(String basePath,
4747
Collection<ExposableServletEndpoint> servletEndpoints) {
4848
Assert.notNull(servletEndpoints, "ServletEndpoints must not be null");
49-
this.basePath = (basePath == null ? "" : basePath);
49+
this.basePath = (basePath != null ? basePath : "");
5050
this.servletEndpoints = servletEndpoints;
5151
}
5252

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyEndpointResourceFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private Map<String, Object> extract(
179179
Map<String, Object> result = new HashMap<>();
180180
multivaluedMap.forEach((name, values) -> {
181181
if (!CollectionUtils.isEmpty(values)) {
182-
result.put(name, values.size() == 1 ? values.get(0) : values);
182+
result.put(name, values.size() != 1 ? values : values.get(0));
183183
}
184184
});
185185
return result;

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ private Map<String, Object> getArguments(ServerWebExchange exchange,
309309
arguments.putAll(body);
310310
}
311311
exchange.getRequest().getQueryParams().forEach((name, values) -> arguments
312-
.put(name, values.size() == 1 ? values.get(0) : values));
312+
.put(name, values.size() != 1 ? values : values.get(0)));
313313
return arguments;
314314
}
315315

@@ -323,8 +323,8 @@ private Mono<ResponseEntity<Object>> handleResult(Publisher<?> result,
323323
.onErrorMap(InvalidEndpointRequestException.class,
324324
(ex) -> new ResponseStatusException(HttpStatus.BAD_REQUEST,
325325
ex.getReason()))
326-
.defaultIfEmpty(new ResponseEntity<>(httpMethod == HttpMethod.GET
327-
? HttpStatus.NOT_FOUND : HttpStatus.NO_CONTENT));
326+
.defaultIfEmpty(new ResponseEntity<>(httpMethod != HttpMethod.GET
327+
? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND));
328328
}
329329

330330
private ResponseEntity<Object> toResponseEntity(Object response) {

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private Map<String, Object> getArguments(HttpServletRequest request,
257257
arguments.putAll(body);
258258
}
259259
request.getParameterMap().forEach((name, values) -> arguments.put(name,
260-
values.length == 1 ? values[0] : Arrays.asList(values)));
260+
values.length != 1 ? Arrays.asList(values) : values[0]));
261261
return arguments;
262262
}
263263

@@ -269,8 +269,8 @@ private Map<String, String> getTemplateVariables(HttpServletRequest request) {
269269

270270
private Object handleResult(Object result, HttpMethod httpMethod) {
271271
if (result == null) {
272-
return new ResponseEntity<>(httpMethod == HttpMethod.GET
273-
? HttpStatus.NOT_FOUND : HttpStatus.NO_CONTENT);
272+
return new ResponseEntity<>(httpMethod != HttpMethod.GET
273+
? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND);
274274
}
275275
if (!(result instanceof WebEndpointResponse)) {
276276
return result;

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentEndpoint.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.springframework.boot.context.properties.bind.PlaceholdersResolver;
3535
import org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver;
3636
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
37+
import org.springframework.boot.origin.Origin;
3738
import org.springframework.boot.origin.OriginLookup;
3839
import org.springframework.core.env.CompositePropertySource;
3940
import org.springframework.core.env.ConfigurableEnvironment;
@@ -152,11 +153,16 @@ private PropertySourceDescriptor describeSource(String sourceName,
152153
private PropertyValueDescriptor describeValueOf(String name, PropertySource<?> source,
153154
PlaceholdersResolver resolver) {
154155
Object resolved = resolver.resolvePlaceholders(source.getProperty(name));
155-
String origin = (source instanceof OriginLookup)
156-
? ((OriginLookup<Object>) source).getOrigin(name).toString() : null;
156+
String origin = ((source instanceof OriginLookup)
157+
? getOrigin((OriginLookup<Object>) source, name) : null);
157158
return new PropertyValueDescriptor(sanitize(name, resolved), origin);
158159
}
159160

161+
private String getOrigin(OriginLookup<Object> lookup, String name) {
162+
Origin origin = lookup.getOrigin(name);
163+
return (origin != null ? origin.toString() : null);
164+
}
165+
160166
private PlaceholdersResolver getResolver() {
161167
return new PropertySourcesPlaceholdersSanitizingResolver(getPropertySources(),
162168
this.sanitizer);

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/flyway/FlywayEndpoint.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public ApplicationFlywayBeans flywayBeans() {
5959
.put(name, new FlywayDescriptor(flyway.info().all())));
6060
ApplicationContext parent = target.getParent();
6161
contextFlywayBeans.put(target.getId(), new ContextFlywayBeans(flywayBeans,
62-
parent == null ? null : parent.getId()));
62+
parent != null ? parent.getId() : null));
6363
target = parent;
6464
}
6565
return new ApplicationFlywayBeans(contextFlywayBeans);
@@ -170,7 +170,7 @@ private FlywayMigration(MigrationInfo info) {
170170
}
171171

172172
private String nullSafeToString(Object obj) {
173-
return (obj == null ? null : obj.toString());
173+
return (obj != null ? obj.toString() : null);
174174
}
175175

176176
public MigrationType getType() {

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicator.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public CompositeReactiveHealthIndicator(HealthAggregator healthAggregator,
5757
Assert.notNull(indicators, "Indicators must not be null");
5858
this.indicators = new LinkedHashMap<>(indicators);
5959
this.healthAggregator = healthAggregator;
60-
this.timeoutCompose = (mono) -> this.timeout != null ? mono.timeout(
61-
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono;
60+
this.timeoutCompose = (mono) -> (this.timeout != null ? mono.timeout(
61+
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono);
6262
}
6363

6464
/**

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public DataSourceHealthIndicator(DataSource dataSource, String query) {
8686
super("DataSource health check failed");
8787
this.dataSource = dataSource;
8888
this.query = query;
89-
this.jdbcTemplate = (dataSource == null ? null : new JdbcTemplate(dataSource));
89+
this.jdbcTemplate = (dataSource != null ? new JdbcTemplate(dataSource) : null);
9090
}
9191

9292
@Override

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpoint.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public ApplicationLiquibaseBeans liquibaseBeans() {
6969
createReport(liquibase, service, factory)));
7070
ApplicationContext parent = target.getParent();
7171
contextBeans.put(target.getId(), new ContextLiquibaseBeans(liquibaseBeans,
72-
parent == null ? null : parent.getId()));
72+
parent != null ? parent.getId() : null));
7373
target = parent;
7474
}
7575
return new ApplicationLiquibaseBeans(contextBeans);
@@ -204,8 +204,8 @@ public ChangeSet(RanChangeSet ranChangeSet) {
204204
this.execType = ranChangeSet.getExecType();
205205
this.id = ranChangeSet.getId();
206206
this.labels = ranChangeSet.getLabels().getLabels();
207-
this.checksum = ranChangeSet.getLastCheckSum() == null ? null
208-
: ranChangeSet.getLastCheckSum().toString();
207+
this.checksum = (ranChangeSet.getLastCheckSum() != null
208+
? ranChangeSet.getLastCheckSum().toString() : null);
209209
this.orderExecuted = ranChangeSet.getOrderExecuted();
210210
this.tag = ranChangeSet.getTag();
211211
}

0 commit comments

Comments
 (0)