stoty commented on code in PR #6456:
URL: https://github.com/apache/hbase/pull/6456#discussion_r2315223761


##########
hbase-common/src/main/java/org/apache/hadoop/hbase/ServerName.java:
##########
@@ -356,13 +359,14 @@ public static ServerName parseServerName(final String 
str) {
    * Checks if the provided server address is formatted as an IPv6 address. 
This method uses Java's
    * InetAddress to parse the input and confirms if the address is an instance 
of Inet6Address for
    * robust validation instead of relying on string splitting.
-   * @param serverAddress The address string to validate (can be a hostname or 
IP)
+   * @param serverAddress The address string to validate
    * @return true if the address is a valid IPv6 address; false otherwise.
    */
   public static boolean isIpv6ServerName(String serverAddress) {
     try {
       InetAddress address = InetAddress.getByName(serverAddress);
-      return address instanceof Inet6Address;
+      return address instanceof Inet6Address && 
!address.getHostName().equals(serverAddress)

Review Comment:
   `!address.getHostName().equals(serverAddress)`
   
   This excludes the cases when the canonical IPv6 address format is supplied.
   Why would we want to do that ?
   
   The colon check looks good.



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

Reply via email to