pan3793 commented on code in PR #7713:
URL: https://github.com/apache/kyuubi/pull/7713#discussion_r3931440262


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/ZooKeeperHiveClientHelper.java:
##########
@@ -96,13 +97,14 @@ private static void updateParamsWithZKServerNode(
     // it must be the server uri added by an older version HS2
     Matcher matcher = kvPattern.matcher(dataStr);
     if (!matcher.find()) {
-      String[] split = dataStr.split(":");
-      if (split.length != 2) {
+      try {
+        IPStackUtils.HostPort hostPort = IPStackUtils.getHostAndPort(dataStr);
+        connParams.setHost(hostPort.getHostname());
+        connParams.setPort(hostPort.getPort());
+      } catch (Exception e) {

Review Comment:
   `getHostAndPort` throws `IllegalArgumentException` only, catch it instead of 
`Exception`.



##########
kyuubi-common/src/main/scala/org/apache/kyuubi/service/TFrontendService.scala:
##########
@@ -120,7 +120,7 @@ abstract class TFrontendService(name: String)
       case (None, None) => serverAddr.getHostAddress
     }
 
-    host + ":" + actualPort
+    IPStackUtils.formatIPAddressForURL(host) + ":" + actualPort

Review Comment:
   Port Hive's `concatHostPort` and use it here, it also validates host and 
port.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to