You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/03/18 00:59:15 UTC

[GitHub] [helix] narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing

narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394052026
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -87,16 +87,18 @@ public ZkRoutingDataWriter(String namespace, String zkAddress) {
 
     // Get the hostname (REST endpoint) from System property
     String hostName = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY);
+    String port = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY);
     if (hostName == null || hostName.isEmpty()) {
       throw new IllegalStateException(
-          "Unable to get the hostname of this server instance. System.getProperty fails to fetch "
+          "Unable to get the hostname of this server instance or the hostname is empty. System.getProperty fails to fetch "
               + MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY + ".");
     }
-    // remove trailing slash
-    if (hostName.charAt(hostName.length() - 1) == '/') {
-      hostName = hostName.substring(0, hostName.length() - 1);
+    if (port == null || port.isEmpty()) {
+      throw new IllegalStateException(
+          "Unable to get the port of this server instance or the port is empty. System.getProperty fails to fetch "
+              + MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY + ".");
 
 Review comment:
   http://webreference.com/html/tutorial2/2.html
   
   Usually port is an optional concept in a URL. Let's not throw an exception. If it's null or empty, we simply don't append it.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org