fixed tooling related problem where empty value of an attribute that should take a bean reference would call the RuntimeBeanReference constructor in the namespace parser and throw a IllegalArgumentException although the problem has already been reported using the ProblemReporter API
This commit is contained in:
parent
dffec3cdcd
commit
fba5e5f0db
|
|
@ -18,8 +18,6 @@ package org.springframework.scripting.config;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.config.ConstructorArgumentValues;
|
import org.springframework.beans.factory.config.ConstructorArgumentValues;
|
||||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||||
|
|
@ -31,6 +29,7 @@ import org.springframework.beans.factory.xml.XmlReaderContext;
|
||||||
import org.springframework.scripting.support.ScriptFactoryPostProcessor;
|
import org.springframework.scripting.support.ScriptFactoryPostProcessor;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.util.xml.DomUtils;
|
import org.springframework.util.xml.DomUtils;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BeanDefinitionParser implementation for the '<code><lang:groovy/></code>',
|
* BeanDefinitionParser implementation for the '<code><lang:groovy/></code>',
|
||||||
|
|
@ -173,8 +172,13 @@ class ScriptBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
||||||
// This is used for Groovy. It's a bean reference to a customizer bean.
|
// This is used for Groovy. It's a bean reference to a customizer bean.
|
||||||
if (element.hasAttribute(CUSTOMIZER_REF_ATTRIBUTE)) {
|
if (element.hasAttribute(CUSTOMIZER_REF_ATTRIBUTE)) {
|
||||||
String customizerBeanName = element.getAttribute(CUSTOMIZER_REF_ATTRIBUTE);
|
String customizerBeanName = element.getAttribute(CUSTOMIZER_REF_ATTRIBUTE);
|
||||||
|
if (!StringUtils.hasText(customizerBeanName)) {
|
||||||
|
parserContext.getReaderContext().error("Attribute 'customizer-ref' has empty value", element);
|
||||||
|
}
|
||||||
|
else {
|
||||||
cav.addIndexedArgumentValue(constructorArgNum++, new RuntimeBeanReference(customizerBeanName));
|
cav.addIndexedArgumentValue(constructorArgNum++, new RuntimeBeanReference(customizerBeanName));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add any property definitions that need adding.
|
// Add any property definitions that need adding.
|
||||||
parserContext.getDelegate().parsePropertyElements(element, bd);
|
parserContext.getDelegate().parsePropertyElements(element, bd);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue