From e7298a88d6034d6534f80b516ec793ea14e4b0cb Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Fri, 15 Jul 2011 20:01:18 +0000 Subject: [PATCH] [SPR-8387] Fixed logic errors in DelegatingSmartContextLoader.processContextConfiguration() and ContextConfigurationAttributes.hasResources(). --- .../test/context/ContextConfigurationAttributes.java | 6 +++--- .../test/context/support/DelegatingSmartContextLoader.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/ContextConfigurationAttributes.java b/org.springframework.test/src/main/java/org/springframework/test/context/ContextConfigurationAttributes.java index fd584ee5bd9..516c489b408 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/ContextConfigurationAttributes.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/ContextConfigurationAttributes.java @@ -168,13 +168,13 @@ public class ContextConfigurationAttributes { /** * Determine if this {@code ContextConfigurationAttributes} instance has * either path-based resource locations or class-based resources. - * @return true if neither the {@link #getLocations() locations} - * nor the {@link #getClasses() classes} array is empty + * @return true if either the {@link #getLocations() locations} + * or the {@link #getClasses() classes} array is not empty * @see #getLocations() * @see #getClasses() */ public boolean hasResources() { - return !ObjectUtils.isEmpty(getLocations()) && !ObjectUtils.isEmpty(getClasses()); + return !ObjectUtils.isEmpty(getLocations()) || !ObjectUtils.isEmpty(getClasses()); } /** diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java b/org.springframework.test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java index 124b9985c97..2be4a49a063 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java @@ -91,7 +91,7 @@ public class DelegatingSmartContextLoader implements SmartContextLoader { // If any loader claims to generate defaults but none actually did, // throw an exception. - if (originallyHadResources && generatesDefaults() && !configAttributes.hasResources()) { + if (generatesDefaults() && !originallyHadResources && !configAttributes.hasResources()) { throw new IllegalStateException(String.format("None of the SmartContextLoader candidates %s " + "was able to generate defaults for context configuration [%s].", candidates, configAttributes)); }