diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java index a09164b54c..c7661d2e18 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java @@ -290,15 +290,15 @@ public class JettyWebServer implements WebServer { public int getPort() { Connector[] connectors = this.server.getConnectors(); for (Connector connector : connectors) { - Integer localPort = getLocalPort(connector); - if (localPort != null && localPort > 0) { + int localPort = getLocalPort(connector); + if (localPort > 0) { return localPort; } } return -1; } - private Integer getLocalPort(Connector connector) { + private int getLocalPort(Connector connector) { if (connector instanceof NetworkConnector networkConnector) { return networkConnector.getLocalPort(); }