museumsvictoria/nodel

Lost friendly error messaging on port clash

justparking opened this issue · 1 comments

Since it's a common error, previous versions of nodel had user friendly messaging when TCP port usage clashed which included ways to remedy the condition. It used to say:

Exception in thread "main" org.nodel.io.UnexpectedIOException: Cannot bind to TCP port 8085; another process must already be bound to the port; use '-p 0' if "any port" binding is preferred`
at org.nodel.host.NanoHTTPD.<init>(NanoHTTPD.java:383)
...

It's now back to generic Java exception handling:

>java -jar \nodelhost-dev-2.2.1-rev493.jar -p 8085
Exception in thread "main" java.net.BindException: Address already in use: JVM_Bind
        at java.net.DualStackPlainSocketImpl.bind0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190)
        at java.net.ServerSocket.bind(ServerSocket.java:375)
        at java.net.ServerSocket.bind(ServerSocket.java:329)
        at org.nanohttpd.protocols.http.ServerRunnable.run(ServerRunnable.java:68)
        at java.lang.Thread.run(Thread.java:748)

A new branch added on my public forked repository.
morimoriysmoon@e6b946a