No critical exception if there is not network (LAN Server)

This commit is contained in:
Bixilon 2020-11-22 18:57:30 +01:00
parent ac87d42c48
commit dcd61d4d41
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -14,7 +14,6 @@
package de.bixilon.minosoft.protocol.protocol;
import java.net.InetAddress;
import java.net.UnknownHostException;
public final class ProtocolDefinition {
public static final int STRING_MAX_LEN = 32767;
@ -41,11 +40,14 @@ public final class ProtocolDefinition {
public static final int DEFAULT_BUFFER_SIZE = 4096;
static {
// java does (why ever) not allow to directly assign a null
InetAddress temp;
try {
LAN_SERVER_BROADCAST_ADDRESS = InetAddress.getByName("224.0.2.60");
} catch (UnknownHostException e) {
temp = InetAddress.getByName("224.0.2.60");
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
temp = null;
}
LAN_SERVER_BROADCAST_ADDRESS = temp;
}
}