Merge branch '2.0.x'
This commit is contained in:
@@ -157,7 +157,7 @@ public class FlywayAutoConfiguration {
|
||||
private String getProperty(Supplier<String> property,
|
||||
Supplier<String> defaultValue) {
|
||||
String value = property.get();
|
||||
return (value == null ? defaultValue.get() : value);
|
||||
return (value != null ? value : defaultValue.get());
|
||||
}
|
||||
|
||||
private void checkLocationExists(String... locations) {
|
||||
|
||||
@@ -56,9 +56,9 @@ class IntegrationAutoConfigurationScanRegistrar extends IntegrationComponentScan
|
||||
@Override
|
||||
protected Collection<String> getBasePackages(
|
||||
AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
|
||||
return AutoConfigurationPackages.has(this.beanFactory)
|
||||
return (AutoConfigurationPackages.has(this.beanFactory)
|
||||
? AutoConfigurationPackages.get(this.beanFactory)
|
||||
: Collections.emptyList();
|
||||
: Collections.emptyList());
|
||||
}
|
||||
|
||||
@IntegrationComponentScan
|
||||
|
||||
@@ -234,8 +234,8 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
|
||||
}
|
||||
if (!StringUtils.hasText(driverClassName)) {
|
||||
throw new DataSourceBeanCreationException(
|
||||
"Failed to determine a suitable driver class",
|
||||
this, this.embeddedDatabaseConnection);
|
||||
"Failed to determine a suitable driver class", this,
|
||||
this.embeddedDatabaseConnection);
|
||||
}
|
||||
return driverClassName;
|
||||
}
|
||||
@@ -277,12 +277,12 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
|
||||
return this.url;
|
||||
}
|
||||
String databaseName = determineDatabaseName();
|
||||
String url = (databaseName == null ? null
|
||||
: this.embeddedDatabaseConnection.getUrl(databaseName));
|
||||
String url = (databaseName != null
|
||||
? this.embeddedDatabaseConnection.getUrl(databaseName) : null);
|
||||
if (!StringUtils.hasText(url)) {
|
||||
throw new DataSourceBeanCreationException(
|
||||
"Failed to determine suitable jdbc url",
|
||||
this, this.embeddedDatabaseConnection);
|
||||
"Failed to determine suitable jdbc url", this,
|
||||
this.embeddedDatabaseConnection);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ public class LiquibaseAutoConfiguration {
|
||||
private String getProperty(Supplier<String> property,
|
||||
Supplier<String> defaultValue) {
|
||||
String value = property.get();
|
||||
return value == null ? defaultValue.get() : value;
|
||||
return (value != null ? value : defaultValue.get());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -81,8 +81,8 @@ public class MongoClientFactory {
|
||||
if (options == null) {
|
||||
options = MongoClientOptions.builder().build();
|
||||
}
|
||||
String host = this.properties.getHost() == null ? "localhost"
|
||||
: this.properties.getHost();
|
||||
String host = (this.properties.getHost() != null ? this.properties.getHost()
|
||||
: "localhost");
|
||||
return new MongoClient(Collections.singletonList(new ServerAddress(host, port)),
|
||||
options);
|
||||
}
|
||||
@@ -101,8 +101,8 @@ public class MongoClientFactory {
|
||||
int port = getValue(properties.getPort(), MongoProperties.DEFAULT_PORT);
|
||||
List<ServerAddress> seeds = Collections
|
||||
.singletonList(new ServerAddress(host, port));
|
||||
return credentials == null ? new MongoClient(seeds, options)
|
||||
: new MongoClient(seeds, credentials, options);
|
||||
return (credentials != null ? new MongoClient(seeds, credentials, options)
|
||||
: new MongoClient(seeds, options));
|
||||
}
|
||||
return createMongoClient(MongoProperties.DEFAULT_URI, options);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class MongoClientFactory {
|
||||
}
|
||||
|
||||
private <T> T getValue(T value, T fallback) {
|
||||
return (value == null ? fallback : value);
|
||||
return (value != null ? value : fallback);
|
||||
}
|
||||
|
||||
private boolean hasCustomAddress() {
|
||||
|
||||
@@ -86,8 +86,8 @@ public class ReactiveMongoClientFactory {
|
||||
private MongoClient createEmbeddedMongoClient(MongoClientSettings settings,
|
||||
int port) {
|
||||
Builder builder = builder(settings);
|
||||
String host = this.properties.getHost() == null ? "localhost"
|
||||
: this.properties.getHost();
|
||||
String host = (this.properties.getHost() != null ? this.properties.getHost()
|
||||
: "localhost");
|
||||
ClusterSettings clusterSettings = ClusterSettings.builder()
|
||||
.hosts(Collections.singletonList(new ServerAddress(host, port))).build();
|
||||
builder.clusterSettings(clusterSettings);
|
||||
@@ -119,16 +119,16 @@ public class ReactiveMongoClientFactory {
|
||||
}
|
||||
|
||||
private void applyCredentials(Builder builder) {
|
||||
String database = this.properties.getAuthenticationDatabase() == null
|
||||
? this.properties.getMongoClientDatabase()
|
||||
: this.properties.getAuthenticationDatabase();
|
||||
String database = (this.properties.getAuthenticationDatabase() != null
|
||||
? this.properties.getAuthenticationDatabase()
|
||||
: this.properties.getMongoClientDatabase());
|
||||
builder.credential((MongoCredential.createCredential(
|
||||
this.properties.getUsername(), database, this.properties.getPassword())));
|
||||
|
||||
}
|
||||
|
||||
private <T> T getOrDefault(T value, T defaultValue) {
|
||||
return (value == null ? defaultValue : value);
|
||||
return (value != null ? value : defaultValue);
|
||||
}
|
||||
|
||||
private MongoClient createMongoClient(Builder builder) {
|
||||
|
||||
@@ -91,8 +91,8 @@ class DataSourceInitializedPublisher implements BeanPostProcessor {
|
||||
if (this.properties == null) {
|
||||
return true; // better safe than sorry
|
||||
}
|
||||
Supplier<String> defaultDdlAuto = () -> EmbeddedDatabaseConnection
|
||||
.isEmbedded(dataSource) ? "create-drop" : "none";
|
||||
Supplier<String> defaultDdlAuto = () -> (EmbeddedDatabaseConnection
|
||||
.isEmbedded(dataSource) ? "create-drop" : "none");
|
||||
Map<String, Object> hibernate = this.properties
|
||||
.getHibernateProperties(new HibernateSettings().ddlAuto(defaultDdlAuto));
|
||||
if (hibernate.containsKey("hibernate.hbm2ddl.auto")) {
|
||||
|
||||
@@ -72,8 +72,8 @@ final class OAuth2ClientPropertiesRegistrationAdapter {
|
||||
|
||||
private static Builder getBuilder(String registrationId, String configuredProviderId,
|
||||
Map<String, Provider> providers) {
|
||||
String providerId = (configuredProviderId == null ? registrationId
|
||||
: configuredProviderId);
|
||||
String providerId = (configuredProviderId != null ? configuredProviderId
|
||||
: registrationId);
|
||||
CommonOAuth2Provider provider = getCommonProvider(providerId);
|
||||
if (provider == null && !providers.containsKey(providerId)) {
|
||||
throw new IllegalStateException(
|
||||
@@ -89,10 +89,10 @@ final class OAuth2ClientPropertiesRegistrationAdapter {
|
||||
|
||||
private static String getErrorMessage(String configuredProviderId,
|
||||
String registrationId) {
|
||||
return (configuredProviderId == null
|
||||
? "Provider ID must be specified for client registration '"
|
||||
+ registrationId + "'"
|
||||
: "Unknown provider ID '" + configuredProviderId + "'");
|
||||
return (configuredProviderId != null
|
||||
? "Unknown provider ID '" + configuredProviderId + "'"
|
||||
: "Provider ID must be specified for client registration '"
|
||||
+ registrationId + "'");
|
||||
}
|
||||
|
||||
private static Builder getBuilder(Builder builder, Provider provider) {
|
||||
|
||||
@@ -93,7 +93,7 @@ final class SessionStoreMappings {
|
||||
}
|
||||
|
||||
private String getName(Class<?> configuration) {
|
||||
return (configuration == null ? null : configuration.getName());
|
||||
return (configuration != null ? configuration.getName() : null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ public class TransactionManagerCustomizers {
|
||||
|
||||
public TransactionManagerCustomizers(
|
||||
Collection<? extends PlatformTransactionManagerCustomizer<?>> customizers) {
|
||||
this.customizers = (customizers == null ? Collections.emptyList()
|
||||
: new ArrayList<>(customizers));
|
||||
this.customizers = (customizers != null ? new ArrayList<>(customizers)
|
||||
: Collections.emptyList());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -110,9 +110,9 @@ public class TomcatWebServerFactoryCustomizer implements
|
||||
}
|
||||
|
||||
private int determineMaxHttpHeaderSize() {
|
||||
return this.serverProperties.getMaxHttpHeaderSize() > 0
|
||||
return (this.serverProperties.getMaxHttpHeaderSize() > 0
|
||||
? this.serverProperties.getMaxHttpHeaderSize()
|
||||
: this.serverProperties.getTomcat().getMaxHttpHeaderSize();
|
||||
: this.serverProperties.getTomcat().getMaxHttpHeaderSize());
|
||||
}
|
||||
|
||||
private void customizeAcceptCount(ConfigurableTomcatWebServerFactory factory,
|
||||
|
||||
@@ -205,7 +205,7 @@ public abstract class AbstractErrorWebExceptionHandler
|
||||
}
|
||||
|
||||
private String htmlEscape(Object input) {
|
||||
return (input == null ? null : HtmlUtils.htmlEscape(input.toString()));
|
||||
return (input != null ? HtmlUtils.htmlEscape(input.toString()) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -338,7 +338,7 @@ public class WebMvcAutoConfiguration {
|
||||
}
|
||||
|
||||
private Integer getSeconds(Duration cachePeriod) {
|
||||
return (cachePeriod == null ? null : (int) cachePeriod.getSeconds());
|
||||
return (cachePeriod != null ? (int) cachePeriod.getSeconds() : null);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -146,7 +146,7 @@ public class WebServicesAutoConfiguration {
|
||||
return this.applicationContext
|
||||
.getResources(ensureTrailingSlash(location) + pattern);
|
||||
}
|
||||
catch (IOException e) {
|
||||
catch (IOException ex) {
|
||||
return new Resource[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
|
||||
String[] dependsOn = ((BeanDefinitionRegistry) context
|
||||
.getSourceApplicationContext()).getBeanDefinition("entityManagerFactory")
|
||||
.getDependsOn();
|
||||
return dependsOn != null ? Arrays.asList(dependsOn) : Collections.emptyList();
|
||||
return (dependsOn != null ? Arrays.asList(dependsOn) : Collections.emptyList());
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -101,7 +101,7 @@ public class JooqPropertiesTests {
|
||||
given(connection.getMetaData()).willReturn(metadata);
|
||||
given(ds.getConnection()).willReturn(connection);
|
||||
}
|
||||
catch (SQLException e) {
|
||||
catch (SQLException ex) {
|
||||
// Do nothing
|
||||
}
|
||||
return ds;
|
||||
|
||||
@@ -136,7 +136,7 @@ public class CustomHibernateJpaAutoConfigurationTests {
|
||||
given(dataSource.getConnection().getMetaData())
|
||||
.willReturn(mock(DatabaseMetaData.class));
|
||||
}
|
||||
catch (SQLException e) {
|
||||
catch (SQLException ex) {
|
||||
// Do nothing
|
||||
}
|
||||
return dataSource;
|
||||
|
||||
@@ -307,7 +307,7 @@ public class JpaPropertiesTests {
|
||||
given(connection.getMetaData()).willReturn(metadata);
|
||||
given(ds.getConnection()).willReturn(connection);
|
||||
}
|
||||
catch (SQLException e) {
|
||||
catch (SQLException ex) {
|
||||
// Do nothing
|
||||
}
|
||||
return ds;
|
||||
|
||||
@@ -52,15 +52,17 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
|
||||
}
|
||||
|
||||
public ServletContext getServletContext() {
|
||||
return getWebServer() == null ? null : getWebServer().getServletContext();
|
||||
return (getWebServer() != null ? getWebServer().getServletContext() : null);
|
||||
}
|
||||
|
||||
public RegisteredServlet getRegisteredServlet(int index) {
|
||||
return getWebServer() == null ? null : getWebServer().getRegisteredServlet(index);
|
||||
return (getWebServer() != null ? getWebServer().getRegisteredServlet(index)
|
||||
: null);
|
||||
}
|
||||
|
||||
public RegisteredFilter getRegisteredFilter(int index) {
|
||||
return getWebServer() == null ? null : getWebServer().getRegisteredFilters(index);
|
||||
return (getWebServer() != null ? getWebServer().getRegisteredFilters(index)
|
||||
: null);
|
||||
}
|
||||
|
||||
public static class MockServletWebServer
|
||||
|
||||
Reference in New Issue
Block a user