groupon / locality-uuid.java

BSD 3-Clause "New" or "Revised" License
80 stars 23 forks source link

Make sure the network interface we grab has a 6 byte hardware address. #3

Closed zippy1981 closed 11 years ago

zippy1981 commented 11 years ago

On Windows (at least my Windows 7 Enterprise laptop) the first interface returned by NetworkInterface.getNetworkInterfaces().neextElement() is the loopback interface which has no mac address. Therefore, I added a little bit or robustness to the function that got the first mac address. Since its only called once it should not be a performance issue.

I ran the unit tests on windows and ubuntu 13.04.

zippy1981 commented 11 years ago

Ok using reflection so the private macaddress() gets called in the test.

As far as isVirtual here is my linux-wired-ethernet-centric explanation.

bakks commented 11 years ago

Tested and it looks good, now merged in. Thanks again for pushing these changes back in, I would be curious to hear about your project