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:
Christian Dupuis 2009-05-15 13:22:30 +00:00
parent dffec3cdcd
commit fba5e5f0db
1 changed files with 7 additions and 3 deletions

View File

@ -18,8 +18,6 @@ package org.springframework.scripting.config;
import java.util.List;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.config.RuntimeBeanReference;
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.util.StringUtils;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;
/**
* BeanDefinitionParser implementation for the '<code>&lt;lang:groovy/&gt;</code>',
@ -173,7 +172,12 @@ class ScriptBeanDefinitionParser extends AbstractBeanDefinitionParser {
// This is used for Groovy. It's a bean reference to a customizer bean.
if (element.hasAttribute(CUSTOMIZER_REF_ATTRIBUTE)) {
String customizerBeanName = element.getAttribute(CUSTOMIZER_REF_ATTRIBUTE);
cav.addIndexedArgumentValue(constructorArgNum++, new RuntimeBeanReference(customizerBeanName));
if (!StringUtils.hasText(customizerBeanName)) {
parserContext.getReaderContext().error("Attribute 'customizer-ref' has empty value", element);
}
else {
cav.addIndexedArgumentValue(constructorArgNum++, new RuntimeBeanReference(customizerBeanName));
}
}
// Add any property definitions that need adding.