Commit 2118d5b4 by David Liu Committed by Ryan Baxter

sanitize the metadata map to remove empty values when building the eureka InstanceInfo (#2826)

parent 65c13bba
...@@ -85,7 +85,10 @@ public class InstanceInfoFactory { ...@@ -85,7 +85,10 @@ public class InstanceInfoFactory {
for (Map.Entry<String, String> mapEntry : config.getMetadataMap().entrySet()) { for (Map.Entry<String, String> mapEntry : config.getMetadataMap().entrySet()) {
String key = mapEntry.getKey(); String key = mapEntry.getKey();
String value = mapEntry.getValue(); String value = mapEntry.getValue();
builder.add(key, value); // only add the metadata if the value is present
if (value != null && !value.isEmpty()) {
builder.add(key, value);
}
} }
InstanceInfo instanceInfo = builder.build(); InstanceInfo instanceInfo = builder.build();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment