+ if (nic != null && nic.getHardwareAddress() != null)
+ return hardwareAddressToNodeId(nic);
+ Enumeration<NetworkInterface> netInterfaces = null;
+ netInterfaces = NetworkInterface.getNetworkInterfaces();
+ if (netInterfaces == null || !netInterfaces.hasMoreElements())
+ throw new IllegalStateException("No interfaces");
+ while (netInterfaces.hasMoreElements()) {
+ // TODO find out public/physical interfaces
+ nic = netInterfaces.nextElement();
+ if (nic.getHardwareAddress() != null)
+ return hardwareAddressToNodeId(nic);
+ }
+ throw new IllegalStateException("No interfaces with a MAC address");