commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Durham David Cntr 805CSS/SCBE" <David.Durh...@scott.af.mil>
Subject [digester] SetNextRule and multiple children
Date Thu, 27 Mar 2003 22:36:28 GMT
Having difficulty adding child objects with Digester.addSetNext()if more than one child exists.

Here's the xml file:

<security-constraints>

    <action path="/SomeAction">
        <group name="SomeGroup"/>
	<!-- If I comment out this next element, it works fine -->
        <group name="SomeOtherGroup"/>
    </action>

</security-constraints>


Here's digester code:
------------------------------------
digester.push(securityConstraints);  // this object has an addConstraint(ActionConstraint)
method.
digester.addObjectCreate("security-constraints/action", mil.usaf.rad.dpart.struts.ActionConstraint");
digester.addSetProperties("security-constraints/action");
digester.addSetNext("security-constraints/action", "addConstraint", "mil.usaf.rad.dpart.struts.ActionConstraint");

digester.addObjectCreate("security-constraints/action/group", "mil.usaf.rad.dpart.struts.Group");
digester.addSetProperties("security-constraints/action/group");
digester.addSetNext("security-constraints/action/group", "add");

digester.parse("someFile");
-------------------------------------



The debug log indicates that after finding the first group it's properties are set and it
is added to ActionConstraint.

Below is what happens when digester finds the second group element and tries to add it to
ActionConstraint.

27-Mar-2003 16:15:27 DEBUG org.apache.commons.digester.Digester - org.apache.commons.digester.SetNextRule
: [SetNextRule]{security-constraints/action/group} Call mil.usaf.rad.dpart.struts.ActionConstraint.add(mil.usaf.rad.dpart.struts.Group@dedb45)
27-Mar-2003 16:15:27 DEBUG org.apache.commons.beanutils.MethodUtils - org.apache.commons.beanutils.MethodUtils
: Matching name=add on class mil.usaf.rad.dpart.struts.ActionConstraint
27-Mar-2003 16:15:27 DEBUG org.apache.commons.beanutils.MethodUtils - org.apache.commons.beanutils.MethodUtils
: Found matching name:
27-Mar-2003 16:15:27 DEBUG org.apache.commons.beanutils.MethodUtils - org.apache.commons.beanutils.MethodUtils
: public boolean java.util.TreeSet.add(java.lang.Object)
27-Mar-2003 16:15:27 DEBUG org.apache.commons.beanutils.MethodUtils - org.apache.commons.beanutils.MethodUtils
: Param=mil.usaf.rad.dpart.struts.Group
27-Mar-2003 16:15:27 DEBUG org.apache.commons.beanutils.MethodUtils - org.apache.commons.beanutils.MethodUtils
: Method=java.lang.Object
27-Mar-2003 16:15:27 DEBUG org.apache.commons.beanutils.MethodUtils - org.apache.commons.beanutils.MethodUtils
: public boolean java.util.TreeSet.add(java.lang.Object) accessible version of public boolean
java.util.TreeSet.add(java.lang.Object)
27-Mar-2003 16:15:27 ERROR org.apache.commons.digester.Digester - org.apache.commons.digester.Digester
: End event threw exception
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
	at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:260)
	at org.apache.commons.digester.Rule.end(Rule.java:276)
	at org.apache.commons.digester.Digester.endElement(Digester.java:1064)
	at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:585)
	at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:222)
	at org.apache.xerces.impl.XMLNamespaceBinder.emptyElement(XMLNamespaceBinder.java:595)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:747)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:329)
	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525)
	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581)
	at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1175)
	at org.apache.commons.digester.Digester.parse(Digester.java:1562)
	at mil.usaf.rad.dpart.struts.AppConfig.getSecurityConstraints(Unknown Source)



Don't want to waste anyone's time but is there something obvious that I'm missing?

Thanks,

Dave




Mime
View raw message