Remove use of wrong DOMUtils class (from com.sun package).

This commit is contained in:
Luke Taylor 2010-05-01 15:04:26 +01:00
parent 863ccecf55
commit dccb30ad63
2 changed files with 8 additions and 6 deletions

View File

@ -21,12 +21,11 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.sun.tools.internal.xjc.util.DOMUtils;
/**
* Registers the central ProviderManager used by the namespace configuration, and allows the configuration of an
* alias, allowing users to reference it in their beans and clearly see where the name is
@ -58,9 +57,12 @@ public class AuthenticationManagerBeanDefinitionParser implements BeanDefinition
if (node instanceof Element) {
Element providerElt = (Element)node;
if (StringUtils.hasText(providerElt.getAttribute(ATT_REF))) {
if (DOMUtils.getChildElements(providerElt).length > 0) {
pc.getReaderContext().error("authentication-provider element cannot have children when used " +
"with 'ref' atribute", pc.extractSource(element));
NodeList providerChildren = providerElt.getChildNodes();
for (int j = 0; j < providerChildren.getLength(); j++) {
if (providerChildren.item(j) instanceof Element) {
pc.getReaderContext().error("authentication-provider element cannot have child elements when used " +
"with 'ref' attribute", pc.extractSource(element));
}
}
providers.add(new RuntimeBeanReference(providerElt.getAttribute(ATT_REF)));
} else {

View File

@ -135,7 +135,7 @@ public class AuthenticationProviderBeanDefinitionParserTests {
public void exernalProviderDoesNotSupportChildElements() throws Exception {
appContext = new InMemoryXmlApplicationContext(
" <authentication-manager>" +
" <authentication-provider ref='aProvider'>" +
" <authentication-provider ref='aProvider'> " +
" <password-encoder ref='customPasswordEncoder'/>" +
" </authentication-provider>" +
" </authentication-manager>" +