Skip to content

Commit 7fc4556

Browse files
committed
Fix checkstyle ternary issues
Fix checkstyle issues with ternary expressions following the spring-javaformat upgrade. See gh-13932
1 parent ec1100a commit 7fc4556

File tree

293 files changed

+714
-685
lines changed

Some content is hidden

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

293 files changed

+714
-685
lines changed

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

Lines changed: 1 addition & 1 deletion
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 ? attributes.getClass("endpoint") : null);
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +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 ? new ReactiveCloudFoundrySecurityService(
130-
webClientBuilder, cloudControllerUrl, skipSslValidation) : null);
129+
return (cloudControllerUrl != null) ? new ReactiveCloudFoundrySecurityService(
130+
webClientBuilder, cloudControllerUrl, skipSslValidation) : null;
131131
}
132132

133133
private CorsConfiguration getCorsConfiguration() {

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

Lines changed: 2 additions & 2 deletions
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 ? new CloudFoundrySecurityService(
134-
restTemplateBuilder, cloudControllerUrl, skipSslValidation) : null);
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

Lines changed: 2 additions & 2 deletions
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 ? context.getParent().getId()
129-
: null);
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

Lines changed: 1 addition & 1 deletion
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 ? responseTimeout.toMillis() : 100,
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

Lines changed: 1 addition & 1 deletion
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 ? poolMetadata.getValidationQuery() : null);
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/MeterRegistryConfigurer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ class MeterRegistryConfigurer {
5151
Collection<MeterFilter> filters,
5252
Collection<MeterRegistryCustomizer<?>> customizers,
5353
boolean addToGlobalRegistry) {
54-
this.binders = (binders != null ? binders : Collections.emptyList());
55-
this.filters = (filters != null ? filters : Collections.emptyList());
56-
this.customizers = (customizers != null ? customizers : Collections.emptyList());
54+
this.binders = (binders != null) ? binders : Collections.emptyList();
55+
this.filters = (filters != null) ? filters : Collections.emptyList();
56+
this.customizers = (customizers != null) ? customizers : Collections.emptyList();
5757
this.addToGlobalRegistry = addToGlobalRegistry;
5858
}
5959

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ public DistributionStatisticConfig configure(Meter.Id id,
6767
}
6868

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

7676
private <T> T lookup(Map<String, T> values, Id id, T defaultValue) {
@@ -84,7 +84,7 @@ private <T> T lookup(Map<String, T> values, Id id, T defaultValue) {
8484
return result;
8585
}
8686
int lastDot = name.lastIndexOf('.');
87-
name = (lastDot != -1 ? name.substring(0, lastDot) : "");
87+
name = (lastDot != -1) ? name.substring(0, lastDot) : "";
8888
}
8989
return values.getOrDefault("all", defaultValue);
9090
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public PropertiesConfigAdapter(T properties) {
5151
*/
5252
protected final <V> V get(Function<T, V> getter, Supplier<V> fallback) {
5353
V value = getter.apply(this.properties);
54-
return (value != null ? value : fallback.get());
54+
return (value != null) ? value : fallback.get();
5555
}
5656

5757
}

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

Lines changed: 1 addition & 1 deletion
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 ? properties.getUri().toString() : null);
63+
return (properties.getUri() != null) ? properties.getUri().toString() : null;
6464
}
6565

6666
}

0 commit comments

Comments
 (0)