Prevent NPE if k8s Client returns null for metadata and/or annotations (#283)

Fixes #282
This commit is contained in:
Georgios Andrianakis
2018-12-05 18:40:50 +02:00
committed by Spencer Gibb
parent c62e67f7ca
commit 70d164a193

View File

@@ -135,6 +135,10 @@ public class KubernetesDiscoveryClient implements DiscoveryClient {
// but with the keys prefixed
// if the prefix is null or empty, the map itself is returned (unchanged of course)
private Map<String, String> getMapWithPrefixedKeys(Map<String, String> map, String prefix) {
if(map == null) {
return new HashMap<>();
}
// when the prefix is empty just return an map with the same entries
if (!StringUtils.hasText(prefix)) {
return map;