From bd709f30c5686d396b53ed2247ef4c52f0a53836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Thu, 12 Nov 2015 11:41:22 -0500 Subject: [PATCH] Fix springProfile with multi profiles separated by comma and whitespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously springProfile supported multi profiles separated by comma but it doesn´t work if there are whitespaces. Now, springProfile will read values cleaning whitespaces. See gh-4445 --- .../boot/logging/logback/SpringProfileAction.java | 4 ++-- .../boot/logging/logback/multi-profile-names.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java index 492be929d05..4ab29581c10 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java @@ -67,8 +67,8 @@ class SpringProfileAction extends Action implements InPlayListener { } private boolean acceptsProfiles(InterpretationContext ic, Attributes attributes) { - String[] profileNames = StringUtils - .commaDelimitedListToStringArray(attributes.getValue(NAME_ATTRIBUTE)); + String[] profileNames = StringUtils.trimArrayElements(StringUtils + .commaDelimitedListToStringArray(attributes.getValue(NAME_ATTRIBUTE))); if (profileNames.length != 0) { for (String profileName : profileNames) { OptionHelper.substVars(profileName, ic, this.context); diff --git a/spring-boot/src/test/resources/org/springframework/boot/logging/logback/multi-profile-names.xml b/spring-boot/src/test/resources/org/springframework/boot/logging/logback/multi-profile-names.xml index 55ccd71ee5d..480897e6742 100644 --- a/spring-boot/src/test/resources/org/springframework/boot/logging/logback/multi-profile-names.xml +++ b/spring-boot/src/test/resources/org/springframework/boot/logging/logback/multi-profile-names.xml @@ -1,7 +1,7 @@ - +