Skip to content

Commit a3c34b4

Browse files
committed
Merge pull request #42798 from ngocnhan-tran1996
* pr/42798: Polish Closes gh-42798
2 parents b16b452 + fcbf6b0 commit a3c34b4

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public void customize(TransactionManager transactionManager) {
5959
* @since 3.2.0
6060
*/
6161
public static TransactionManagerCustomizers of(Collection<? extends TransactionManagerCustomizer<?>> customizers) {
62-
return new TransactionManagerCustomizers((customizers != null) ? new ArrayList<>(customizers)
63-
: Collections.<TransactionManagerCustomizer<?>>emptyList());
62+
return new TransactionManagerCustomizers(
63+
(customizers != null) ? new ArrayList<>(customizers) : Collections.emptyList());
6464
}
6565

6666
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletPath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ default String getPrefix() {
7474
* @return the path as a servlet URL mapping
7575
*/
7676
default String getServletUrlMapping() {
77-
if (getPath().equals("") || getPath().equals("/")) {
77+
if (getPath().isEmpty() || getPath().equals("/")) {
7878
return "/";
7979
}
8080
if (getPath().contains("*")) {

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public void setLoadOnStartup(int loadOnStartup) {
237237
}
238238

239239
public String getServletMapping() {
240-
if (this.path.equals("") || this.path.equals("/")) {
240+
if (this.path.isEmpty() || this.path.equals("/")) {
241241
return "/";
242242
}
243243
if (this.path.endsWith("/")) {

spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/jdbc/TestDatabaseAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ private boolean isUsingTestDatasourceUrl() {
214214
List<ConfigurationProperty> bound = new ArrayList<>();
215215
Binder.get(this.environment, new BoundPropertiesTrackingBindHandler(bound::add))
216216
.bind(DATASOURCE_URL_PROPERTY, BINDABLE_STRING);
217-
return (!bound.isEmpty()) ? isUsingTestDatasourceUrl(bound.get(0)) : false;
217+
return !bound.isEmpty() && isUsingTestDatasourceUrl(bound.get(0));
218218
}
219219

220220
private boolean isUsingTestDatasourceUrl(ConfigurationProperty configurationProperty) {

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ private void processEndpoint(AnnotationMirror annotation, TypeElement element) {
303303
boolean enabledByDefaultAttribute = (boolean) elementValues.getOrDefault("enableByDefault", true);
304304
String defaultAccess = (!enabledByDefaultAttribute) ? "none"
305305
: (elementValues.getOrDefault("defaultAccess", "unrestricted").toString()).toLowerCase(Locale.ENGLISH);
306-
boolean enabledByDefault = "none".equals(defaultAccess) ? false : enabledByDefaultAttribute;
306+
boolean enabledByDefault = !"none".equals(defaultAccess) && enabledByDefaultAttribute;
307307
String type = this.metadataEnv.getTypeUtils().getQualifiedName(element);
308308
this.metadataCollector.addIfAbsent(ItemMetadata.newGroup(endpointKey, type, type, null));
309309
ItemMetadata accessProperty = ItemMetadata.newProperty(endpointKey, "access", endpointAccessEnum(), type, null,

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/SpringEnvironmentPropertySource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public String getProperty(String key) {
4848
@Override
4949
public boolean containsProperty(String key) {
5050
Environment environment = this.environment;
51-
return (environment != null) ? environment.containsProperty(key) : false;
51+
return environment != null && environment.containsProperty(key);
5252
}
5353

5454
void setEnvironment(Environment environment) {

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ private String getContextPath() {
416416
.map(TomcatEmbeddedContext.class::cast)
417417
.filter(this::imperative)
418418
.map(TomcatEmbeddedContext::getPath)
419-
.map((path) -> path.equals("") ? "/" : path)
419+
.map((path) -> path.isEmpty() ? "/" : path)
420420
.collect(Collectors.joining(" "));
421421
return StringUtils.hasText(contextPath) ? contextPath : null;
422422
}

0 commit comments

Comments
 (0)