diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudPlatform.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudPlatform.java index d55f1f13c0..f74b4135f0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudPlatform.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudPlatform.java @@ -149,7 +149,7 @@ public enum CloudPlatform { */ public boolean isEnforced(Environment environment) { String platform = environment.getProperty("spring.main.cloud-platform"); - return (platform != null) ? name().equalsIgnoreCase(platform) : false; + return name().equalsIgnoreCase(platform); } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java index b7c192f632..668fe82727 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -232,7 +232,6 @@ public class DeferredLog implements Log { return; case FATAL: log.fatal(message, throwable); - return; } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatGracefulShutdown.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatGracefulShutdown.java index b0f79a93f2..8878dc178f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatGracefulShutdown.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatGracefulShutdown.java @@ -18,6 +18,7 @@ package org.springframework.boot.web.embedded.tomcat; import java.time.Duration; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.apache.catalina.Container; @@ -106,9 +107,7 @@ class TomcatGracefulShutdown implements GracefulShutdown { private List getConnectors() { List connectors = new ArrayList<>(); for (Service service : this.tomcat.getServer().findServices()) { - for (Connector connector : service.findConnectors()) { - connectors.add(connector); - } + Collections.addAll(connectors, service.findConnectors()); } return connectors; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java index 7b07da0247..b023c3af92 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java @@ -251,11 +251,11 @@ public class UndertowWebServer implements WebServer { @Override public boolean shutDownGracefully() { - return (this.gracefulShutdown != null) ? this.gracefulShutdown.shutDownGracefully() : false; + return (this.gracefulShutdown != null) && this.gracefulShutdown.shutDownGracefully(); } boolean inGracefulShutdown() { - return (this.gracefulShutdown != null) ? this.gracefulShutdown.isShuttingDown() : false; + return (this.gracefulShutdown != null) && this.gracefulShutdown.isShuttingDown(); } /**