From a66e7c2bfbecb6865adc795d40484018a80f3622 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Wed, 17 Jun 2015 11:17:40 -0600 Subject: [PATCH] only add property if key has text fixes gh-42 --- .../cloud/consul/config/ConsulPropertySource.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java index 9934ac68..a7439712 100644 --- a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java +++ b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java @@ -28,6 +28,7 @@ import com.ecwid.consul.v1.ConsulClient; import com.ecwid.consul.v1.QueryParams; import com.ecwid.consul.v1.Response; import com.ecwid.consul.v1.kv.model.GetValue; +import org.springframework.util.StringUtils; /** * @author Spencer Gibb @@ -56,7 +57,9 @@ public class ConsulPropertySource extends EnumerablePropertySource for (GetValue getValue : values) { String key = getValue.getKey().replace(context, "").replace('/', '.'); String value = getDecoded(getValue.getValue()); - properties.put(key, value); + if (StringUtils.hasText(key)) { + properties.put(key, value); + } } } }