nvazquez commented on a change in pull request #3419: console-proxy: fix 
potential NPE condition
URL: https://github.com/apache/cloudstack/pull/3419#discussion_r297416963
 
 

 ##########
 File path: core/src/main/java/com/cloud/info/ConsoleProxyInfo.java
 ##########
 @@ -56,14 +56,12 @@ public ConsoleProxyInfo(boolean sslEnabled, String 
proxyIpAddress, int port, int
     private String formatProxyAddress(String consoleProxyUrlDomain, String 
proxyIpAddress) {
         StringBuffer sb = new StringBuffer();
         // Domain in format *.example.com, proxy IP is 1.2.3.4 --> 
1-2-3-4.example.com
-        if (consoleProxyUrlDomain.startsWith("*")) {
+        if (consoleProxyUrlDomain != null && 
consoleProxyUrlDomain.startsWith("*")) {
 
 Review comment:
   Can we reorder this if-then-else to:
   
   ````
   if (StringUtils.isBlank(consoleProxyUrlDomain) {
      // Blank config, we use the proxy IP
      sb.append(proxyIpAddress);
   } else if (consoleProxyUrlDomain.startsWith("*")) {
      sb.append(proxyIpAddress.replaceAll("\\.", "-"));
      sb.append(consoleProxyUrlDomain.substring(1)); // skip the *
   } else {
      // Otherwise we assume a valid domain if config not blank
      sb.append(consoleProxyUrlDomain);
   }
   ````

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to