Revisit Assert to avoid single-arg assert methods (with refined messages)
Issue: SPR-15196
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -219,7 +219,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
if (!(beanFactory instanceof ConfigurableListableBeanFactory)) {
|
||||
throw new IllegalArgumentException(
|
||||
"AutowiredAnnotationBeanPostProcessor requires a ConfigurableListableBeanFactory");
|
||||
"AutowiredAnnotationBeanPostProcessor requires a ConfigurableListableBeanFactory: " + beanFactory);
|
||||
}
|
||||
this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -102,12 +102,12 @@ public class CustomScopeConfigurer implements BeanFactoryPostProcessor, BeanClas
|
||||
}
|
||||
else if (value instanceof Class) {
|
||||
Class<?> scopeClass = (Class<?>) value;
|
||||
Assert.isAssignable(Scope.class, scopeClass);
|
||||
Assert.isAssignable(Scope.class, scopeClass, "Invalid scope class");
|
||||
beanFactory.registerScope(scopeKey, (Scope) BeanUtils.instantiateClass(scopeClass));
|
||||
}
|
||||
else if (value instanceof String) {
|
||||
Class<?> scopeClass = ClassUtils.resolveClassName((String) value, this.beanClassLoader);
|
||||
Assert.isAssignable(Scope.class, scopeClass);
|
||||
Assert.isAssignable(Scope.class, scopeClass, "Invalid scope class");
|
||||
beanFactory.registerScope(scopeKey, (Scope) BeanUtils.instantiateClass(scopeClass));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -762,7 +762,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
@Override
|
||||
public void registerCustomEditor(Class<?> requiredType, Class<? extends PropertyEditor> propertyEditorClass) {
|
||||
Assert.notNull(requiredType, "Required type must not be null");
|
||||
Assert.isAssignable(PropertyEditor.class, propertyEditorClass);
|
||||
Assert.notNull(propertyEditorClass, "PropertyEditor class must not be null");
|
||||
this.customEditors.put(requiredType, propertyEditorClass);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user