Only throw PortInUseException if port is set
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
This commit is contained in:
parent
7f51984cbd
commit
b2abc8ff3f
|
@ -101,7 +101,7 @@ public class NettyWebServer implements WebServer {
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
PortInUseException.ifCausedBy(ex, ChannelBindException.class, (bindException) -> {
|
PortInUseException.ifCausedBy(ex, ChannelBindException.class, (bindException) -> {
|
||||||
if (!isPermissionDenied(bindException.getCause())) {
|
if (bindException.localPort() > 0 && !isPermissionDenied(bindException.getCause())) {
|
||||||
throw new PortInUseException(bindException.localPort(), ex);
|
throw new PortInUseException(bindException.localPort(), ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue