using hasText instead of simple null check for collectionName

This commit is contained in:
Mark Fisher
2011-08-04 12:40:53 -04:00
parent 304e9b2abb
commit 97c61e2512

View File

@@ -41,6 +41,7 @@ import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.store.MessageStore;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import com.mongodb.DBObject;
@@ -68,7 +69,7 @@ public class MongoMessageStore implements MessageStore, BeanClassLoaderAware {
Assert.notNull(mongoDbFactory, "mongoDbFactory must not be null");
MessageReadingMongoConverter converter = new MessageReadingMongoConverter(mongoDbFactory, new MongoMappingContext());
this.template = new MongoTemplate(mongoDbFactory, converter);
this.collectionName = (collectionName != null) ? collectionName : DEFAULT_COLLECTION_NAME;
this.collectionName = (StringUtils.hasText(collectionName)) ? collectionName : DEFAULT_COLLECTION_NAME;
//this.template.createCollection(collectionName);
}