difin commented on code in PR #5729:
URL: https://github.com/apache/hive/pull/5729#discussion_r2029356248


##########
service/src/java/org/apache/hive/service/server/HS2ActivePassiveHARegistry.java:
##########
@@ -173,9 +173,9 @@ private void addEndpointToServiceRecord(
 
   private void updateEndpoint(final ServiceRecord srv, final String 
endpointName) {
     final String instanceUri = srv.get(INSTANCE_URI_CONFIG);
-    final String[] tokens = instanceUri.split(":");
-    final String hostname = tokens[0];
-    final int port = Integer.parseInt(tokens[1]);
+    IPStackUtils.HostPort hostPort = IPStackUtils.splitHostPort(instanceUri);
+    final String hostname = hostPort.getHostname();
+    final int port = hostPort.getPort();

Review Comment:
   As I see it the problem with this method is that for IPv6 it works only if 
the hostname portion is enclosed in square brackets (e.g. `[::1]:1000`), while 
my custom method works even if it is not enclosed in square brackets. While it 
is mandatory for URI to enclose IPv6 in square brackets, it depends on the code 
that produces the parsed string to enclose IPv6 in square brackets. Also, what 
we are parsing here is not a complete URI (URI must contain protocol type such 
as `http://196.0.0.1:9000` while we parse only `host: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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to