stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lasi...@apache.org
Subject stratos git commit: Adding a null check for public IPs before creating access URLs for kubernetes
Date Sun, 02 Aug 2015 14:45:20 GMT
Repository: stratos
Updated Branches:
  refs/heads/master 6c960c7e9 -> 83e7fbe37


Adding a null check for public IPs before creating access URLs for kubernetes


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/83e7fbe3
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/83e7fbe3
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/83e7fbe3

Branch: refs/heads/master
Commit: 83e7fbe373a119ba14cf3e6f1aab33c7e77bf413
Parents: 6c960c7
Author: lasinducharith <lasinducharith@gmail.com>
Authored: Sun Aug 2 20:14:42 2015 +0530
Committer: lasinducharith <lasinducharith@gmail.com>
Committed: Sun Aug 2 20:14:42 2015 +0530

----------------------------------------------------------------------
 .../messaging/topology/TopologyBuilder.java         | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/83e7fbe3/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
index 7acd0f5..acc7bd4 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
@@ -883,11 +883,17 @@ public class TopologyBuilder {
                         String[] publicIPs = kubernetesService.getPublicIPs();
                         if ((publicIPs != null) && (publicIPs.length > 0)) {
                             for (String publicIP : publicIPs) {
-                                // Using type URI since only http, https, ftp, file, jar
protocols are supported in URL
-                                URI accessURL = new URI(kubernetesService.getProtocol(),
null, publicIP,
-                                        kubernetesService.getPort(), null, null, null);
-                                cluster.addAccessUrl(accessURL.toString());
-                                clusterInstanceActivatedEvent.addAccessUrl(accessURL.toString());
+                                // There can be a String array with null values
+                                if (publicIP != null) {
+                                    // Using type URI since only http, https, ftp, file,
jar protocols are supported in URL
+                                    URI accessURL = new URI(kubernetesService.getProtocol(),
null, publicIP,
+                                            kubernetesService.getPort(), null, null, null);
+                                    cluster.addAccessUrl(accessURL.toString());
+                                    clusterInstanceActivatedEvent.addAccessUrl(accessURL.toString());
+                                } else {
+                                    log.error(String.format("Could not create access URL
for [Kubernetes-service] %s , " +
+                                            "since Public IP is not available", kubernetesService.getId()));
+                                }
                             }
                         }
                     }


Mime
View raw message