From 94037facb8775da017f9ea17a44203c8d1f504ce Mon Sep 17 00:00:00 2001 From: dhgarrette Date: Fri, 20 Mar 2009 15:12:16 +0000 Subject: [PATCH] RESOLVED - BATCH-1165: Allow 'id' and 'ref' to exist together on <*-listener/> --- .../core/configuration/xml/AbstractListenerParser.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractListenerParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractListenerParser.java index aa79fcc01..d2f0a7e96 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractListenerParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractListenerParser.java @@ -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); } }