zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanm <...@git.apache.org>
Subject [GitHub] zookeeper pull request #320: ZOOKEEPER-2614 Port ZOOKEEPER-1576 to branch 3....
Date Sun, 30 Jul 2017 16:27:05 GMT
Github user hanm commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/320#discussion_r130246293
  
    --- Diff: src/java/main/org/apache/zookeeper/client/StaticHostProvider.java ---
    @@ -52,34 +52,36 @@
          * 
          * @param serverAddresses
          *            possibly unresolved ZooKeeper server addresses
    -     * @throws UnknownHostException
          * @throws IllegalArgumentException
          *             if serverAddresses is empty or resolves to an empty list
          */
    -    public StaticHostProvider(Collection<InetSocketAddress> serverAddresses)
    -            throws UnknownHostException {
    +    public StaticHostProvider(Collection<InetSocketAddress> serverAddresses) {
             for (InetSocketAddress address : serverAddresses) {
    -            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()));
    -                }  
    -            }
    +        	try {
    --- End diff --
    
    Indentation here is a little bit off. 4 spaces instead of 8. Please update. Other than
this patch looks good.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message