> On Feb. 21, 2015, 1:37 a.m., Gwen Shapira wrote:
> > core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala, lines 
> > 130-140
> > <https://reviews.apache.org/r/31226/diff/1/?file=870240#file870240line130>
> >
> >     I'm confused... what's wrong with:
> >     "InetAddress.getAddress"
> >     or 
> >     "InetAddress.getLocalHost.getAddress"
> >     ?

InetAddress.getAddress won't work because we don't have an instead of the 
Inetaddress all we are doing before is calling the static 
InetAddress.getLocalHost.  InetAddess.getLocalHost.getAddress will not work 
because it is the "getLocalHost" method that is throwing the exception when 
trying to get the localhost machine.  because of this any method of the 
InetAddress cannot be used and an alternative method needed to be found (hence 
going through the NIC's and finding an IP).


> On Feb. 21, 2015, 1:37 a.m., Gwen Shapira wrote:
> > core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala,
> >  lines 71-84
> > <https://reviews.apache.org/r/31226/diff/1/?file=870241#file870241line71>
> >
> >     I don't see any asserts here... Can you document what will a failure 
> > look like?
> >     
> >     I assume that this doesn't actually test a non-resolving host (since 
> > this is impossible to create in a test, as you noted), so what do we test 
> > here?

correct really no way to assert anything. 

the only way to truely test that it will grab an IP is to alter the 
ZookeeperConsumerConnector class and manually throw a UnknownHostException 
prior to the initial InetAddress.getLocalHost.getHostName call aka:

core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala

insert on line 20:

throw new UnknownHostException


- Jonathan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/31226/#review73369
-----------------------------------------------------------


On Feb. 20, 2015, 3:07 p.m., Jonathan Rafalski wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/31226/
> -----------------------------------------------------------
> 
> (Updated Feb. 20, 2015, 3:07 p.m.)
> 
> 
> Review request for kafka.
> 
> 
> Repository: kafka
> 
> 
> Description
> -------
> 
> adding try/catch to getting hostname to allow the use of the first 
> non-loopback IP address when hostname is not resolvable.
> 
> 
> Diffs
> -----
> 
>   core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala 3e1718b 
>   
> core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala 
> 8c4687b 
> 
> Diff: https://reviews.apache.org/r/31226/diff/
> 
> 
> Testing
> -------
> 
> for testing this code I included the unit test that forces the generation of 
> the ID however if you cannot get your local to not resovle you will need to 
> manually throw the exception in the try/catch in order to test.
> 
> 
> Thanks,
> 
> Jonathan Rafalski
> 
>

Reply via email to