Browse Source

Polish

See gh-42798
pull/42813/head
Tran Ngoc Nhan 1 year ago committed by Moritz Halbritter
parent
commit
fcbf6b0200
  1. 4
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java
  2. 2
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletPath.java
  3. 2
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java
  4. 2
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/jdbc/TestDatabaseAutoConfiguration.java
  5. 2
      spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java
  6. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/SpringEnvironmentPropertySource.java
  7. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java

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

@ -59,8 +59,8 @@ public final class TransactionManagerCustomizers { @@ -59,8 +59,8 @@ public final class TransactionManagerCustomizers {
* @since 3.2.0
*/
public static TransactionManagerCustomizers of(Collection<? extends TransactionManagerCustomizer<?>> customizers) {
return new TransactionManagerCustomizers((customizers != null) ? new ArrayList<>(customizers)
: Collections.<TransactionManagerCustomizer<?>>emptyList());
return new TransactionManagerCustomizers(
(customizers != null) ? new ArrayList<>(customizers) : Collections.emptyList());
}
}

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

@ -74,7 +74,7 @@ public interface DispatcherServletPath { @@ -74,7 +74,7 @@ public interface DispatcherServletPath {
* @return the path as a servlet URL mapping
*/
default String getServletUrlMapping() {
if (getPath().equals("") || getPath().equals("/")) {
if (getPath().isEmpty() || getPath().equals("/")) {
return "/";
}
if (getPath().contains("*")) {

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

@ -237,7 +237,7 @@ public class WebMvcProperties { @@ -237,7 +237,7 @@ public class WebMvcProperties {
}
public String getServletMapping() {
if (this.path.equals("") || this.path.equals("/")) {
if (this.path.isEmpty() || this.path.equals("/")) {
return "/";
}
if (this.path.endsWith("/")) {

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

@ -214,7 +214,7 @@ public class TestDatabaseAutoConfiguration { @@ -214,7 +214,7 @@ public class TestDatabaseAutoConfiguration {
List<ConfigurationProperty> bound = new ArrayList<>();
Binder.get(this.environment, new BoundPropertiesTrackingBindHandler(bound::add))
.bind(DATASOURCE_URL_PROPERTY, BINDABLE_STRING);
return (!bound.isEmpty()) ? isUsingTestDatasourceUrl(bound.get(0)) : false;
return !bound.isEmpty() && isUsingTestDatasourceUrl(bound.get(0));
}
private boolean isUsingTestDatasourceUrl(ConfigurationProperty configurationProperty) {

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

@ -303,7 +303,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor @@ -303,7 +303,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
boolean enabledByDefaultAttribute = (boolean) elementValues.getOrDefault("enableByDefault", true);
String defaultAccess = (!enabledByDefaultAttribute) ? "none"
: (elementValues.getOrDefault("defaultAccess", "unrestricted").toString()).toLowerCase(Locale.ENGLISH);
boolean enabledByDefault = "none".equals(defaultAccess) ? false : enabledByDefaultAttribute;
boolean enabledByDefault = !"none".equals(defaultAccess) && enabledByDefaultAttribute;
String type = this.metadataEnv.getTypeUtils().getQualifiedName(element);
this.metadataCollector.addIfAbsent(ItemMetadata.newGroup(endpointKey, type, type, null));
ItemMetadata accessProperty = ItemMetadata.newProperty(endpointKey, "access", endpointAccessEnum(), type, null,

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

@ -48,7 +48,7 @@ class SpringEnvironmentPropertySource implements PropertySource { @@ -48,7 +48,7 @@ class SpringEnvironmentPropertySource implements PropertySource {
@Override
public boolean containsProperty(String key) {
Environment environment = this.environment;
return (environment != null) ? environment.containsProperty(key) : false;
return environment != null && environment.containsProperty(key);
}
void setEnvironment(Environment environment) {

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

@ -416,7 +416,7 @@ public class TomcatWebServer implements WebServer { @@ -416,7 +416,7 @@ public class TomcatWebServer implements WebServer {
.map(TomcatEmbeddedContext.class::cast)
.filter(this::imperative)
.map(TomcatEmbeddedContext::getPath)
.map((path) -> path.equals("") ? "/" : path)
.map((path) -> path.isEmpty() ? "/" : path)
.collect(Collectors.joining(" "));
return StringUtils.hasText(contextPath) ? contextPath : null;
}

Loading…
Cancel
Save