diff --git a/examples/cassandra/README.md b/examples/cassandra/README.md index a463c9fa1b61a..18338a233a951 100644 --- a/examples/cassandra/README.md +++ b/examples/cassandra/README.md @@ -295,10 +295,13 @@ public class KubernetesSeedProvider implements SeedProvider { ObjectMapper mapper = new ObjectMapper(); Endpoints endpoints = mapper.readValue(url, Endpoints.class); if (endpoints != null) { + // Here is a problem point, endpoints.endpoints can be null in first node cases. + if (endpoints.endpoints != null){ for (String endpoint : endpoints.endpoints) { String[] parts = endpoint.split(":"); list.add(InetAddress.getByName(parts[0])); } + } } } catch (IOException ex) { logger.warn("Request to kubernetes apiserver failed"); diff --git a/examples/cassandra/java/io/k8s/cassandra/KubernetesSeedProvider.java b/examples/cassandra/java/io/k8s/cassandra/KubernetesSeedProvider.java index e1e2fbae92137..8b8ad40bb9014 100644 --- a/examples/cassandra/java/io/k8s/cassandra/KubernetesSeedProvider.java +++ b/examples/cassandra/java/io/k8s/cassandra/KubernetesSeedProvider.java @@ -70,10 +70,13 @@ public List getSeeds() { ObjectMapper mapper = new ObjectMapper(); Endpoints endpoints = mapper.readValue(url, Endpoints.class); if (endpoints != null) { + // Here is a problem point, endpoints.endpoints can be null in first node cases. + if (endpoints.endpoints != null){ for (String endpoint : endpoints.endpoints) { String[] parts = endpoint.split(":"); list.add(InetAddress.getByName(parts[0])); } + } } } catch (IOException ex) { logger.warn("Request to kubernetes apiserver failed");