srinireddy2020 commented on code in PR #6456:
URL: https://github.com/apache/hbase/pull/6456#discussion_r3445580103
##########
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:
Here we are checking the given address is in hostname format or the actual
address format. And validating the address is in IPV6 format or not.
so that, even for all formats of IPV6 address is identifying correctly.
--
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]