diff --git a/spring-data-geode/src/main/java/org/springframework/data/gemfire/client/ClientCacheFactoryBean.java b/spring-data-geode/src/main/java/org/springframework/data/gemfire/client/ClientCacheFactoryBean.java index 9350128c..99ad6d70 100644 --- a/spring-data-geode/src/main/java/org/springframework/data/gemfire/client/ClientCacheFactoryBean.java +++ b/spring-data-geode/src/main/java/org/springframework/data/gemfire/client/ClientCacheFactoryBean.java @@ -348,7 +348,7 @@ public class ClientCacheFactoryBean extends CacheFactoryBean implements Applicat * @see #findPool(String) * @see #isPoolNameResolvable(String) */ - protected Pool resolvePool() { + protected @Nullable Pool resolvePool() { Pool pool = getPool(); @@ -372,21 +372,22 @@ public class ClientCacheFactoryBean extends CacheFactoryBean implements Applicat return pool; } - private boolean isPoolNameResolvable(String poolName) { + private boolean isPoolNameResolvable(@Nullable String poolName) { return Optional.ofNullable(poolName) + .filter(StringUtils::hasText) .filter(getBeanFactory()::containsBean) .isPresent(); } - String resolvePoolName() { + @NonNull String resolvePoolName() { return Optional.ofNullable(getPoolName()) .filter(StringUtils::hasText) .orElseGet(this::getDefaultPoolName); } - String getDefaultPoolName() { + @NonNull String getDefaultPoolName() { return GemfireConstants.DEFAULT_GEMFIRE_POOL_NAME; } @@ -406,7 +407,7 @@ public class ClientCacheFactoryBean extends CacheFactoryBean implements Applicat */ @Override @SuppressWarnings("unchecked") - protected T createCache(Object factory) { + protected @NonNull T createCache(@NonNull Object factory) { return (T) ((ClientCacheFactory) factory).create(); }