battlecode-server-2017
battlecode-server-2017 copied to clipboard
Avoid a NullPointerException in NetServer.onError
I saw the following stack trace:
Exception in thread "WebsocketSelector14" java.lang.NullPointerException
at battlecode.server.NetServer.onError(NetServer.java:165)
at org.java_websocket.server.WebSocketServer.handleFatal(WebSocketServer.java:439)
at org.java_websocket.server.WebSocketServer.run(WebSocketServer.java:287)
at java.lang.Thread.run(Thread.java:745)
and indeed the first argument to onError
can sometimes be null, so this seems like a reasonable fix.
How did you obtain this error? I was able to reproduce this exception by starting two instances of the server simultaneously, but this produces fairly seriously erroneous behavior across the server, and is in general not supported.
Yeah, I think I got that from running two servers at the same time (trying to parallelize testing).