diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationStyle.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationStyle.java index 5d4969439d..613b6e2b5a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationStyle.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationStyle.java @@ -221,7 +221,7 @@ public enum DurationStyle { } public Duration parse(String value) { - return Duration.of(Long.valueOf(value), this.chronoUnit); + return Duration.of(Long.parseLong(value), this.chronoUnit); } public String print(Duration value) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java index 6b602226b3..950463a093 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java @@ -167,7 +167,7 @@ public class JettyReactiveWebServerFactory extends AbstractReactiveWebServerFact } protected Server createJettyServer(JettyHttpHandlerAdapter servlet) { - int port = (getPort() >= 0) ? getPort() : 0; + int port = Math.max(getPort(), 0); InetSocketAddress address = new InetSocketAddress(getAddress(), port); Server server = new Server(getThreadPool()); server.addConnector(createConnector(address, server)); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java index c8a71762b5..8876432d36 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java @@ -137,7 +137,7 @@ public class JettyServletWebServerFactory extends AbstractServletWebServerFactor @Override public WebServer getWebServer(ServletContextInitializer... initializers) { JettyEmbeddedWebAppContext context = new JettyEmbeddedWebAppContext(); - int port = (getPort() >= 0) ? getPort() : 0; + int port = Math.max(getPort(), 0); InetSocketAddress address = new InetSocketAddress(getAddress(), port); Server server = createServer(address); configureWebAppContext(context, initializers); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java index 9d08033456..01a63a70de 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java @@ -176,7 +176,7 @@ public class TomcatReactiveWebServerFactory extends AbstractReactiveWebServerFac } protected void customizeConnector(Connector connector) { - int port = (getPort() >= 0) ? getPort() : 0; + int port = Math.max(getPort(), 0); connector.setPort(port); if (StringUtils.hasText(this.getServerHeader())) { connector.setAttribute("server", this.getServerHeader()); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java index 3fbca1f21a..4c63e69538 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java @@ -299,7 +299,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto // Needs to be protected so it can be used by subclasses protected void customizeConnector(Connector connector) { - int port = (getPort() >= 0) ? getPort() : 0; + int port = Math.max(getPort(), 0); connector.setPort(port); if (StringUtils.hasText(this.getServerHeader())) { connector.setAttribute("server", this.getServerHeader()); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/NameAndAgeJsonKeyComponent.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/NameAndAgeJsonKeyComponent.java index b49e637633..f98d7b5927 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/NameAndAgeJsonKeyComponent.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/NameAndAgeJsonKeyComponent.java @@ -46,7 +46,7 @@ public class NameAndAgeJsonKeyComponent { @Override public NameAndAge deserializeKey(String key, DeserializationContext ctxt) throws IOException { String[] keys = key.split("is"); - return new NameAndAge(keys[0].trim(), Integer.valueOf(keys[1].trim())); + return new NameAndAge(keys[0].trim(), Integer.parseInt(keys[1].trim())); } }