[
https://issues.apache.org/jira/browse/ZOOKEEPER-2614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16106544#comment-16106544
]
ASF GitHub Bot commented on ZOOKEEPER-2614:
-------------------------------------------
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.
> Port ZOOKEEPER-1576 to branch3.4
> --------------------------------
>
> Key: ZOOKEEPER-2614
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2614
> Project: ZooKeeper
> Issue Type: Bug
> Affects Versions: 3.4.9
> Reporter: Vishal Khandelwal
> Assignee: Vishal Khandelwal
> Fix For: 3.4.11
>
> Attachments: ZOOKEEPER-2614.branch-3.4.00.patch
>
>
> ZOOKEEPER-1576 handles UnknownHostException and it good to have this change
> for 3.4 branch as well. Porting the changes to 3.4 after resolving the
> conflicts
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)