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


##########
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:
   Once a canonical IPv6 address is recognized and parsed as an `Inet6Address`, 
the code compares the input string directly to the address’s canonical textual 
representation. If they match, it confirms the input is a literal IPv6 address; 
otherwise, it is likely a hostname or non-canonical form, and the check returns 
false.



-- 
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: issues-unsubscr...@hbase.apache.org

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

Reply via email to