From 9c871e44e9aac74ca4c351f2b2da328e8243e6ab Mon Sep 17 00:00:00 2001 From: funcsion Date: Sun, 13 Oct 2019 14:05:12 +0800 Subject: [PATCH] fix setting null value of property in xml throws NullPointerException (#2646) * fix setting value of property in xml is null throws NullPointerException * fix setting null value of property in xml throws NullPointerException --- .../framework/apollo/spring/property/PlaceholderHelper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/PlaceholderHelper.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/PlaceholderHelper.java index 281792e339a..39c587c27e7 100644 --- a/apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/PlaceholderHelper.java +++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/PlaceholderHelper.java @@ -4,6 +4,7 @@ import com.google.common.collect.Sets; import java.util.Set; import java.util.Stack; +import java.util.Objects; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanExpressionContext; @@ -65,7 +66,7 @@ private Object evaluateBeanDefinitionString(ConfigurableBeanFactory beanFactory, public Set extractPlaceholderKeys(String propertyString) { Set placeholderKeys = Sets.newHashSet(); - if (!isNormalizedPlaceholder(propertyString) && !isExpressionWithPlaceholder(propertyString)) { + if (Objects.isNull(propertyString) || (!isNormalizedPlaceholder(propertyString) && !isExpressionWithPlaceholder(propertyString))) { return placeholderKeys; }