timoninmaxim commented on code in PR #12080: URL: https://github.com/apache/ignite/pull/12080#discussion_r2114071952
########## modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java: ########## @@ -334,13 +335,65 @@ public void testNotEmptyHostNameAttr() throws Exception { locHost = ip; checkHostNamesAttr(startGrid(nodeIdx++), false, false); - locHost = host; - checkHostNamesAttr(startGrid(nodeIdx++), false, false); + // If found host name, then check it. + if (host != null) { + locHost = host; + checkHostNamesAttr(startGrid(nodeIdx++), false, false); + } locHost = null; checkHostNamesAttr(startGrid(nodeIdx++), true, false); } + /** @return Host name, or {@code null} if all addresses are IPs. */ + private @Nullable String findHostName(Collection<String> addrs) { + return addrs.stream() + .filter(addr -> { + try { + // Skips optional IPv6 zone ID (e.g., fe80::1%lo0) because InetAddress#getByName might fail to parse it. + String[] parts = addr.split("%", 2); + + InetAddress inet = InetAddress.getByName(parts[0]); + + return !(inet instanceof Inet6Address) && !(inet instanceof Inet4Address); Review Comment: My bad, I fixed the logic. -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org