From 278e3c1d1bcf5f4f94a36e57042983b5f2002ffc Mon Sep 17 00:00:00 2001 From: Costin Leau Date: Thu, 25 Aug 2011 16:25:05 +0300 Subject: [PATCH] SGF-35 + check pool name before using it --- .../client/ClientRegionFactoryBean.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/springframework/data/gemfire/client/ClientRegionFactoryBean.java b/src/main/java/org/springframework/data/gemfire/client/ClientRegionFactoryBean.java index 4a33599e..5e4ec24c 100644 --- a/src/main/java/org/springframework/data/gemfire/client/ClientRegionFactoryBean.java +++ b/src/main/java/org/springframework/data/gemfire/client/ClientRegionFactoryBean.java @@ -22,6 +22,7 @@ import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.data.gemfire.RegionFactoryBean; import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Region; @@ -55,15 +56,17 @@ public class ClientRegionFactoryBean extends RegionFactoryBean imple @Override protected void postProcess(AttributesFactory attrFactory) { - // try to eagerly initialize the pool name, if defined as a bean - if (beanFactory.isTypeMatch(poolName, Pool.class)) { - if (log.isDebugEnabled()) { - log.debug("Found bean definition for pool '" + poolName + "'. Eagerly initializing it..."); + if (StringUtils.hasText(poolName)) { + // try to eagerly initialize the pool name, if defined as a bean + if (beanFactory.isTypeMatch(poolName, Pool.class)) { + if (log.isDebugEnabled()) { + log.debug("Found bean definition for pool '" + poolName + "'. Eagerly initializing it..."); + } + beanFactory.getBean(poolName, Pool.class); } - beanFactory.getBean(poolName, Pool.class); - } - attrFactory.setPoolName(poolName); + attrFactory.setPoolName(poolName); + } } @Override @@ -93,7 +96,7 @@ public class ClientRegionFactoryBean extends RegionFactoryBean imple this.beanFactory = beanFactory; } - + /** * Set the interests for this client region. Both key and regex interest are supported. *