From 4165863859a69d148a851e29224df3beb0b75a2e Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 27 Apr 2020 10:41:02 +0200 Subject: [PATCH] Polish contribution See gh-21130 --- .../boot/context/properties/bind/ValueObjectBinder.java | 5 ++++- .../java/org/springframework/boot/logging/DeferredLog.java | 2 +- .../boot/web/embedded/tomcat/TomcatGracefulShutdown.java | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ValueObjectBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ValueObjectBinder.java index db31f878e1..0b320a6262 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ValueObjectBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ValueObjectBinder.java @@ -117,7 +117,10 @@ class ValueObjectBinder implements DataObjectBinder { } private boolean isEmptyDefaultValueAllowed(Class type) { - return !type.isPrimitive() && !type.isEnum() && !isAggregate(type) && !type.getName().startsWith("java.lang"); + if (type.isPrimitive() || type.isEnum() || isAggregate(type) || type.getName().startsWith("java.lang")) { + return false; + } + return true; } private boolean isAggregate(Class type) { 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 4c3b6f21bb..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. 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 b883275dc9..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,7 +18,7 @@ package org.springframework.boot.web.embedded.tomcat; import java.time.Duration; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collections; import java.util.List; import org.apache.catalina.Container; @@ -107,7 +107,7 @@ class TomcatGracefulShutdown implements GracefulShutdown { private List getConnectors() { List connectors = new ArrayList<>(); for (Service service : this.tomcat.getServer().findServices()) { - connectors.addAll(Arrays.asList(service.findConnectors())); + Collections.addAll(connectors, service.findConnectors()); } return connectors; }