Skip to content

Commit

Permalink
Fixed NPE in dumping network interface information (https://issues.re…
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Feb 2, 2021
1 parent 29e439f commit a7300d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/org/jgroups/protocols/UDP.java
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,12 @@ protected String dumpSocketInfo() throws Exception {
formatter.format("\nmcast_sock: bound to %s:%d, send buffer size=%d, receive buffer size=%d",
mcast_sock.getLocalAddress(), mcast_sock.getLocalPort(),
mcast_sock.getSendBufferSize(), mcast_sock.getReceiveBufferSize());
NetworkInterface nic=bind_addr != null? NetworkInterface.getByInetAddress(bind_addr) : null;
String nic_name=nic != null? nic.getName() : "n/a";
if(bind_port > 0)
formatter.format("\n%s: using the network interface '%s' with port range '%s-%s'", bind_addr, NetworkInterface.getByInetAddress(bind_addr).getName(), bind_port, (bind_port + port_range));
formatter.format("\n%s: using network interface '%s' with port range '%s-%s'", bind_addr, nic_name, bind_port, (bind_port + port_range));
else
formatter.format("\n%s: using the network interface '%s' to any (ephemeral) port", bind_addr, NetworkInterface.getByInetAddress(bind_addr).getName());
formatter.format("\n%s: using network interface '%s' to any (ephemeral) port", bind_addr, nic_name);
return sb.toString();
}

Expand Down

0 comments on commit a7300d3

Please sign in to comment.