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
							
								
									4822516fb7
								
							
						
					
					
						commit
						d195815488
					
				|  | @ -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