Catch UnknownHostException in checkRunning() gracefully.
This commit is contained in:
parent
c833015c1b
commit
b85b9f206b
1 changed files with 6 additions and 1 deletions
|
@ -638,7 +638,12 @@ public class Server implements IPathElement, Runnable {
|
||||||
private void checkRunning(InetAddrPort addrPort) throws Exception {
|
private void checkRunning(InetAddrPort addrPort) throws Exception {
|
||||||
InetAddress addr = addrPort.getInetAddress();
|
InetAddress addr = addrPort.getInetAddress();
|
||||||
if (addr == null) {
|
if (addr == null) {
|
||||||
addr = InetAddress.getLocalHost();
|
try {
|
||||||
|
addr = InetAddress.getLocalHost();
|
||||||
|
} catch (UnknownHostException unknown) {
|
||||||
|
System.err.println("Error checking running server: localhost is unknown.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
new Socket(addr, addrPort.getPort());
|
new Socket(addr, addrPort.getPort());
|
||||||
|
|
Loading…
Add table
Reference in a new issue