Github user afine commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/451#discussion_r165527366
--- Diff: src/java/main/org/apache/zookeeper/client/StaticHostProvider.java
---
@@ -57,29 +62,12 @@
*/
public StaticHostProvider(Collection<InetSocketAddress>
serverAddresses) {
for (InetSocketAddress address : serverAddresses) {
- try {
- InetAddress ia = address.getAddress();
- InetAddress resolvedAddresses[] =
InetAddress.getAllByName((ia != null) ? ia.getHostAddress() :
- address.getHostName());
- for (InetAddress resolvedAddress : resolvedAddresses) {
- // If hostName is null but the address is not, we can
tell that
- // the hostName is an literal IP address. Then we can
set the host string as the hostname
- // safely to avoid reverse DNS lookup.
- // As far as i know, the only way to check if the
hostName is null is use toString().
- // Both the two implementations of InetAddress are
final class, so we can trust the return value of
- // the toString() method.
- if (resolvedAddress.toString().startsWith("/")
- && resolvedAddress.getAddress() != null) {
- this.serverAddresses.add(
- new
InetSocketAddress(InetAddress.getByAddress(
- address.getHostName(),
- resolvedAddress.getAddress()),
- address.getPort()));
- } else {
- this.serverAddresses.add(new
InetSocketAddress(resolvedAddress.getHostAddress(), address.getPort()));
- }
- }
- } catch (UnknownHostException e) {
+ try {
--- End diff --
something is wrong with the indentation here
---