From 2e29c89b841f6c00e30ea8fdc02510c2dbb41d39 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Mon, 30 Sep 2013 08:54:02 -0700 Subject: [PATCH] Default null value in ConfigKey results in NPE on second start --- .../cloudstack/framework/config/impl/ConfigDepotImpl.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java index b516596febc..97430ef91f9 100644 --- a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java +++ b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java @@ -25,13 +25,13 @@ import javax.annotation.PostConstruct; import javax.inject.Inject; import org.apache.log4j.Logger; - import org.apache.cloudstack.framework.config.ConfigDepot; import org.apache.cloudstack.framework.config.ConfigDepotAdmin; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; import org.apache.cloudstack.framework.config.ScopedConfigStorage; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; +import org.apache.commons.lang.ObjectUtils; import com.cloud.utils.Pair; import com.cloud.utils.component.SystemIntegrityChecker; @@ -97,10 +97,8 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin, SystemInt _configDao.persist(vo); } else { if (vo.isDynamic() != key.isDynamic() || - !vo.getDescription().equals(key.description()) || - ((vo.getDefaultValue() != null && key.defaultValue() == null) || - (vo.getDefaultValue() == null && key.defaultValue() != null) || - !vo.getDefaultValue().equals(key.defaultValue()))) { + !ObjectUtils.equals(vo.getDescription(), vo.getDescription()) || + !ObjectUtils.equals(vo.getDefaultValue(), key.defaultValue())) { vo.setDynamic(key.isDynamic()); vo.setDescription(key.description()); vo.setDefaultValue(key.defaultValue());