[SPR-8387] Fixed logic errors in DelegatingSmartContextLoader.processContextConfiguration() and ContextConfigurationAttributes.hasResources().

This commit is contained in:
Sam Brannen 2011-07-15 20:01:18 +00:00
parent e34fa6abb1
commit e7298a88d6
2 changed files with 4 additions and 4 deletions

View File

@ -168,13 +168,13 @@ public class ContextConfigurationAttributes {
/**
* Determine if this {@code ContextConfigurationAttributes} instance has
* either path-based resource locations or class-based resources.
* @return <code>true</code> if neither the {@link #getLocations() locations}
* nor the {@link #getClasses() classes} array is empty
* @return <code>true</code> 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());
}
/**

View File

@ -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));
}