mirror of https://github.com/apache/activemq.git
Merge pull request #569 from garydgregory/NPE_NetworkInterface_getNetworkInterfaces
Guard against null NetworkInterface.getNetworkInterfaces()
This commit is contained in:
commit
5bc7532d42
|
@ -345,6 +345,7 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable {
|
|||
private NetworkInterface findNetworkInterface() throws SocketException {
|
||||
Enumeration<NetworkInterface> ifcs = NetworkInterface.getNetworkInterfaces();
|
||||
List<NetworkInterface> possibles = new ArrayList<NetworkInterface>();
|
||||
if (ifcs != null) {
|
||||
while (ifcs.hasMoreElements()) {
|
||||
NetworkInterface ni = ifcs.nextElement();
|
||||
try {
|
||||
|
@ -360,6 +361,7 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable {
|
|||
}
|
||||
} catch (SocketException ignored) {}
|
||||
}
|
||||
}
|
||||
return possibles.isEmpty() ? null : possibles.get(possibles.size() - 1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue