difin commented on code in PR #5729:
URL: https://github.com/apache/hive/pull/5729#discussion_r2029393456
##########
jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java:
##########
@@ -178,12 +179,13 @@ private static void
updateParamsWithZKServerNode(JdbcConnectionParams connParams
// it must be the server uri added by an older version HS2
Matcher matcher = kvPattern.matcher(dataStr);
if ((dataStr != null) && (!matcher.find())) {
- String[] split = dataStr.split(":");
- if (split.length != 2) {
+ try {
+ IPStackUtils.HostPort hostPort = IPStackUtils.splitHostPort(dataStr);
+ connParams.setHost(hostPort.getHostname());
+ connParams.setPort(hostPort.getPort());
+ } catch (Exception e) {
throw new ZooKeeperHiveClientException("Unable to parse HiveServer2
URI from ZooKeeper data: " + dataStr);
}
- connParams.setHost(split[0]);
- connParams.setPort(Integer.parseInt(split[1]));
Review Comment:
This method also doesn't work if hostname is IPv6 and not enclosed in square
brackets and what we are parsing is not a complete URI..
--
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]