You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/07/12 20:36:49 UTC

[GitHub] [zookeeper] arshadmohammad commented on a change in pull request #1398: ZOOKEEPER-3878: Client connection fails if IPV6 is not enclosed in sq…

arshadmohammad commented on a change in pull request #1398:
URL: https://github.com/apache/zookeeper/pull/1398#discussion_r453360716



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/client/ConnectStringParser.java
##########
@@ -70,16 +69,22 @@ public ConnectStringParser(String connectString) {
         List<String> hostsList = split(connectString, ",");
         for (String host : hostsList) {
             int port = DEFAULT_PORT;
-            try {
-                String[] hostAndPort = ConfigUtils.getHostAndPort(host);
+            String[] hostAndPort = NetUtils.getIPV6HostAndPort(host);
+            if (hostAndPort.length != 0) {
                 host = hostAndPort[0];
                 if (hostAndPort.length == 2) {
                     port = Integer.parseInt(hostAndPort[1]);
                 }
-            } catch (ConfigException e) {
-                e.printStackTrace();
+            } else {

Review comment:
       I wanted to make getIPV6HostAndPort  API more generic so it can be used other places as well for example it can be used to input of  host:port:port and [host]:port:port  as well. If we move above said logic to getIPV6HostAndPort  host:port:port will give wrong result; So I wanted to keep only common logic in  getIPV6HostAndPort.




----------------------------------------------------------------
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