From c7473f9124014ea02e83fa87fff67601d1dab1a7 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 31 May 2011 22:12:53 +0000 Subject: [PATCH] [SPR-7960] No longer tracking empty activated profiles. --- .../test/context/ContextLoaderUtils.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java b/org.springframework.test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java index 2f414deff15..63aca620643 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java @@ -18,6 +18,7 @@ package org.springframework.test.context; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import org.apache.commons.logging.Log; @@ -252,7 +253,15 @@ abstract class ContextLoaderUtils { profiles = valueProfiles; } - profilesList.addAll(0, Arrays. asList(profiles)); + if (!ObjectUtils.isEmpty(profiles)) { + Collections.reverse(Arrays. asList(profiles)); + + for (String profile : profiles) { + if (StringUtils.hasText(profile)) { + profilesList.add(0, profile); + } + } + } declaringClass = activateProfiles.inheritProfiles() ? AnnotationUtils.findAnnotationDeclaringClass( annotationType, declaringClass.getSuperclass()) : null;