commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Duckworth <andrew_duckwo...@yahoo.com.au>
Subject Betwixt problem on cyclic bean graphs
Date Tue, 30 Aug 2005 01:44:50 GMT
Hi,
 
I'm using betwixt 0.7 and in a test case I'm trying to write XML for 
two beans, a parent & a child that refer to each other. This works 
correctly with beanWriter.setWriteEmptyElements(true), but fails with a 
StackOverflowError when beanWriter.setWriteEmptyElements(true). I have also 
tested with the current nightly build and it does the same  thing, is 
this expected behaviour ?
 
Kind Regards,
 
Andrew Duckworth
 
andrew_duckworth@yahoo.com.au
 

java.lang.StackOverflowError
 at 
org.apache.commons.betwixt.expression.MethodExpression.getArguments(MethodExpression.java:126)
 at 
org.apache.commons.betwixt.expression.MethodExpression.evaluate(MethodExpression.java:59)
 at 
org.apache.commons.betwixt.io.AbstractBeanWriter.isEmptyElement(AbstractBeanWriter.java:1114)
 at 
org.apache.commons.betwixt.io.AbstractBeanWriter.isEmptyElement(AbstractBeanWriter.java:1103)
 at 
org.apache.commons.betwixt.io.AbstractBeanWriter.isEmptyElement(AbstractBeanWriter.java:1120)
 at 
org.apache.commons.betwixt.io.AbstractBeanWriter.isEmptyElement(AbstractBeanWriter.java:1103)
 at 
org.apache.commons.betwixt.io.AbstractBeanWriter.isEmptyElement(AbstractBeanWriter.java:1120)

.... more omitted for brevity :)
 
 
 
 
public class ParentBean
{
    /** nested child */
    private ChildBean child;
    /**
     * Returns the child of this instance.
     * 
     * @return the value of child
     */
    public ChildBean getChild()
    {
        return child;
    }
    /**
     * Modifies the child of this instance.
     * 
     * @param aBean the new value of child
     */
    public void setChild(ChildBean aBean)
    {
        child = aBean;
    }
}

public class ChildBean
{
    /** nested bean */
    private ParentBean parent;
    /**
     * Returns the parent of this instance.
     * 
     * @return the value of bean
     */
    public ParentBean getParent()
    {
        return parent;
    }
    /**
     * Modifies the parent of this instance.
     * 
     * @param aBean the new value of bean
     */
    public void setParent(ParentBean aBean)
    {
        parent = aBean;
    }
}

 
test case:
 
    public void testCircularBeanGraphToXml()
    {
        ParentBean bean = new ParentBean();
        ChildBean nestedBean = new ChildBean();
        bean.setChild(nestedBean);
        nestedBean.setParent(bean);
 
        ......
    }
 

 	


Send instant messages to your online friends http://au.messenger.yahoo.com 
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message