RESOLVED - BATCH-1165: Allow 'id' and 'ref' to exist together on <*-listener/>

This commit is contained in:
dhgarrette
2009-03-20 15:12:16 +00:00
parent a8a6f27e83
commit 94037facb8

View File

@@ -59,7 +59,7 @@ public abstract class AbstractListenerParser {
private void checkListenerElementAttributes(ParserContext parserContext, Element element, String id,
String listenerRef, String className) {
if ((StringUtils.hasText(id) || StringUtils.hasText(className)) && StringUtils.hasText(listenerRef)) {
if (StringUtils.hasText(className) && StringUtils.hasText(listenerRef)) {
NamedNodeMap attributeNodes = element.getAttributes();
StringBuilder attributes = new StringBuilder();
for (int i = 0; i < attributeNodes.getLength(); i++) {
@@ -69,9 +69,8 @@ public abstract class AbstractListenerParser {
attributes.append(attributeNodes.item(i));
}
parserContext.getReaderContext().error(
"Both 'ref' and " + (StringUtils.hasText(id) ? "'id'" : "'class'")
+ " specified; use 'class' with an optional 'id' or just 'ref' for <"
+ element.getTagName() + "> element specified with attributes: " + attributes, element);
"Either 'ref' or 'class' may be specified, but not both; <" + element.getTagName()
+ "> element specified with attributes: " + attributes, element);
}
}