Skip to content
Closed

Polish #42798

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public void customize(TransactionManager transactionManager) {
* @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());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ default String getPrefix() {
* @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("*")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void setLoadOnStartup(int loadOnStartup) {
}

public String getServletMapping() {
if (this.path.equals("") || this.path.equals("/")) {
if (this.path.isEmpty() || this.path.equals("/")) {
return "/";
}
if (this.path.endsWith("/")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private boolean isUsingTestDatasourceUrl() {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private void processEndpoint(AnnotationMirror annotation, TypeElement element) {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public String getProperty(String key) {
@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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ private String getContextPath() {
.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;
}
Expand Down