> On Feb. 24, 2015, 2:15 a.m., Gwen Shapira wrote: > > core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala, line > > 133 > > <https://reviews.apache.org/r/31226/diff/1/?file=870240#file870240line133> > > > > I think hostname will not be null because you set it to "localhost" > > when defining? > > Jonathan Rafalski wrote: > you are absolutely right, I added the hostname==null in there when I was > trying to pull the first nic with a hostname attached, but it didn't work > consistently for me (sometime it would find the host name (if it resolved > originally) and sometimes not so that is when I added the default of > localhost in to make sure it would never be null but forgot to take this out. > > I will update the diff and get it back up here.
ok I fixed and updated the diff file now checking for hostname.equals("localhost") to account for the default value. I did this instead of remove it completely as if we don't check this we will be getting the last non-loopback IP not the first. - Jonathan ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/31226/#review73733 ----------------------------------------------------------- On Feb. 24, 2015, 3:12 p.m., Jonathan Rafalski wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/31226/ > ----------------------------------------------------------- > > (Updated Feb. 24, 2015, 3:12 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 > >