Catch UnknownHostException in checkRunning() gracefully.

This commit is contained in:
hns 2003-12-04 09:57:49 +00:00
parent c833015c1b
commit b85b9f206b

View file

@ -638,7 +638,12 @@ public class Server implements IPathElement, Runnable {
private void checkRunning(InetAddrPort addrPort) throws Exception {
InetAddress addr = addrPort.getInetAddress();
if (addr == null) {
try {
addr = InetAddress.getLocalHost();
} catch (UnknownHostException unknown) {
System.err.println("Error checking running server: localhost is unknown.");
return;
}
}
try {
new Socket(addr, addrPort.getPort());