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
48c97342fe
commit
d80005a955
|
|
@ -18,10 +18,6 @@ package org.springframework.jms.config;
|
|||
|
||||
import javax.jms.Session;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
|
||||
|
|
@ -30,6 +26,9 @@ import org.springframework.beans.factory.support.RootBeanDefinition;
|
|||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
/**
|
||||
* Abstract parser for JMS listener container elements, providing support for
|
||||
|
|
@ -116,7 +115,9 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
parserContext.getReaderContext().error(
|
||||
"Listener 'ref' attribute contains empty value.", listenerEle);
|
||||
}
|
||||
listenerDef.getPropertyValues().addPropertyValue("delegate", new RuntimeBeanReference(ref));
|
||||
else {
|
||||
listenerDef.getPropertyValues().addPropertyValue("delegate", new RuntimeBeanReference(ref));
|
||||
}
|
||||
|
||||
String method = null;
|
||||
if (listenerEle.hasAttribute(METHOD_ATTRIBUTE)) {
|
||||
|
|
@ -130,8 +131,14 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
|
||||
if (containerEle.hasAttribute(MESSAGE_CONVERTER_ATTRIBUTE)) {
|
||||
String messageConverter = containerEle.getAttribute(MESSAGE_CONVERTER_ATTRIBUTE);
|
||||
listenerDef.getPropertyValues().addPropertyValue("messageConverter",
|
||||
new RuntimeBeanReference(messageConverter));
|
||||
if (!StringUtils.hasText(messageConverter)) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Listener container 'message-converter' attribute contains empty value.", containerEle);
|
||||
}
|
||||
else {
|
||||
listenerDef.getPropertyValues().addPropertyValue("messageConverter",
|
||||
new RuntimeBeanReference(messageConverter));
|
||||
}
|
||||
}
|
||||
|
||||
BeanDefinition containerDef = parseContainer(listenerEle, containerEle, parserContext);
|
||||
|
|
|
|||
|
|
@ -16,13 +16,12 @@
|
|||
|
||||
package org.springframework.jms.config;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for the JMS <code><jca-listener-container></code> element.
|
||||
|
|
@ -49,9 +48,11 @@ class JcaListenerContainerParser extends AbstractListenerContainerParser {
|
|||
parserContext.getReaderContext().error(
|
||||
"Listener container 'resource-adapter' attribute contains empty value.", containerEle);
|
||||
}
|
||||
else {
|
||||
containerDef.getPropertyValues().addPropertyValue("resourceAdapter",
|
||||
new RuntimeBeanReference(resourceAdapterBeanName));
|
||||
}
|
||||
}
|
||||
containerDef.getPropertyValues().addPropertyValue("resourceAdapter",
|
||||
new RuntimeBeanReference(resourceAdapterBeanName));
|
||||
|
||||
String activationSpecFactoryBeanName = containerEle.getAttribute(ACTIVATION_SPEC_FACTORY_ATTRIBUTE);
|
||||
String destinationResolverBeanName = containerEle.getAttribute(DESTINATION_RESOLVER_ATTRIBUTE);
|
||||
|
|
|
|||
|
|
@ -18,13 +18,12 @@ package org.springframework.jms.config;
|
|||
|
||||
import javax.jms.Session;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for the JMS <code><listener-container></code> element.
|
||||
|
|
@ -83,8 +82,10 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
|
|||
"Listener container 'connection-factory' attribute contains empty value.", containerEle);
|
||||
}
|
||||
}
|
||||
containerDef.getPropertyValues().addPropertyValue("connectionFactory",
|
||||
new RuntimeBeanReference(connectionFactoryBeanName));
|
||||
if (StringUtils.hasText(connectionFactoryBeanName)) {
|
||||
containerDef.getPropertyValues().addPropertyValue("connectionFactory",
|
||||
new RuntimeBeanReference(connectionFactoryBeanName));
|
||||
}
|
||||
|
||||
String taskExecutorBeanName = containerEle.getAttribute(TASK_EXECUTOR_ATTRIBUTE);
|
||||
if (StringUtils.hasText(taskExecutorBeanName)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue