Skip to content

Commit

Permalink
Only throw PortInUseException if port is set
Browse files Browse the repository at this point in the history
Refine the `PortInUseException` logic in `NettyWebServer` to only throw
an exception if the port is set. The prevents a misleading exception
from being thrown when a domain socket is being used.

Closes gh-24529
  • Loading branch information
philwebb committed Dec 17, 2020
1 parent 7f51984 commit b2abc8f
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -101,7 +101,7 @@ public void start() throws WebServerException {
}
catch (Exception ex) {
PortInUseException.ifCausedBy(ex, ChannelBindException.class, (bindException) -> {
if (!isPermissionDenied(bindException.getCause())) {
if (bindException.localPort() > 0 && !isPermissionDenied(bindException.getCause())) {
throw new PortInUseException(bindException.localPort(), ex);
}
});
Expand Down

0 comments on commit b2abc8f

Please sign in to comment.