commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [betwixt]: Cycles cause StackOverflowError when registering bean
Date Wed, 14 Jan 2004 22:31:21 GMT
hi brian

thanks for the test case (i probably wouldn't have tracked it down  
otherwise). i've taken quite a good look at the problem and the bad  
news is that it's not really worth fixing on head (it'd be very  
difficult without break other stuff). the design of that part of the  
system has been completely refactored on the branch and the branch does  
not have this problem.

if you can't wait for the refactored branch to be merged into the HEAD  
(which will probably be in some weeks time), you're going to need to  
get hold of the source from CVS.

one option is to roll your own jar based on the branch  
(REFACTORING-BRANCH_2004-01-13). the code is very messy and there's a  
lot more refactoring to come (so the interfaces are likely to change in  
a backwards compatible way) but only one unit test fails.

alternative, you could try to patch the HEAD source in a way that will  
(probably) break some of betwixt's features that you don't use. i will  
give you some hints but i need to concentrate on getting the  
refactoring finished and so i can't spend too long.

- robert

On 13 Jan 2004, at 23:08, b p wrote:

> I am assuming that by "donating your code" you mean the test case I  
> included in my previous message which can certainly be donated to ASF.
>
> If you find it is possible, a patch to fix the problem would be  
> appreciated.
>
> Thanks for your responses,
> Brian
>
> robert burrell donkin <robertburrelldonkin@blueyonder.co.uk> wrote:
> darn. it's fixed on the refactoring branch i've been working on for a
> long while now but probably not on head. if you're cool about donating
> your code to the ASF i'll take a look and see about creating a patch
> for HEAD. (i'm not promising: if it looks too difficult, i'll probably
> concentrate on improving the refactored stuff.)
>
> - robert
>
> On 13 Jan 2004, at 21:51, b p wrote:
>
>> Hi,
>>
>> I was using the binary distribution from last night
>> (commons-betwixt-20040113.zip). I just tried building locally from
>> the the CVS Head and saw the same behavior.
>>
>> Below I included a small test that causes the StackOverflowError.
>>
>> Thanks,
>> Brian
>>
>>
>>
>> ------------------------------------------
>> public class TestBetwixt extends TestCase {
>>
>> public void testCycle() throws IntrospectionException, SAXException,
>> IOException {
>> BeanReader beanReader = new BeanReader();
>> beanReader.registerBeanClass(PersonTest.class);
>> }
>>
>> public static Test suite() {
>> return new TestSuite(TestCycle.class);
>> }
>> }
>>
>> ---------------------------------------------
>> public class PersonTest {
>> private String name;
>> private AddressTest address;
>> public String getName() {
>> return name;
>> }
>> public void setName(String name) {
>> this.name = name;
>> }
>> public AddressTest getAddress() {
>> return address;
>> }
>> public void setAddress(AddressTest address) {
>> this.address = address;
>> }
>> }
>>
>> ----------------------------------------------------
>> public class AddressTest {
>> private String streetAddress;
>> private ReferenceTest reference;
>> public String getStreetAddress() {
>> return streetAddress;
>> }
>> public void setStreetAddress(String streetAddress) {
>> this.streetAddress = streetAddress;
>> }
>> public ReferenceTest getReference() {
>> return reference;
>> }
>> public void setReference(ReferenceTest reference) {
>> this.reference = reference;
>> }
>> }
>>
>> -----------------------------------------------------
>> public class ReferenceTest {
>> private PersonTest person = null;
>> public PersonTest getPerson() {
>> return person;
>> }
>> public void setPerson(PersonTest person) {
>> this.person = person;
>> }
>> }
>>
>>
>>
>> robert burrell donkin wrote:
>> hi
>>
>> which version are you using? (i have a feeling that this bug has been
>> fixed already but i might be wrong...)
>>
>> if you're using the alpha, i'd suggest upgrading to CVS HEAD (you'll
>> need commons-beanutils 1.6.1 and commons-digester 1.5).
>>
>> - robert
>>
>> On 13 Jan 2004, at 19:38, b p wrote:
>>
>>> Hi,
>>>
>>> I have been investigating Betwixt and run into an issue with cycles.
>>> I have 3 beans with a cycle:
>>> A->-B
>>> B->C
>>> C->A
>>>
>>> I'm able to generate XML successfully, but not read it. When I call
>>> BeanReader.registerBeanClass(A) I get a StackOverflowError (printed
>>> below). If I take out the cycle, it works fine. I performed the test
>>> using the binary distribution 20040113.
>>>
>>> Does betwixt support cycles? If so, is there something specific I
>>> need to do to avoid what appears to be a recursive infinite loop?
>>>
>>> Thanks in advance,
>>>
>>> Brian
>>>
>>> java.lang.StackOverflowError
>>> at java.lang.Object.hashCode(Native Method)
>>> at java.util.HashMap.hash(HashMap.java:261)
>>> at java.util.HashMap.get(HashMap.java:317)
>>> at
>>> org.apache.commons.betwixt.registry.DefaultXMLBeanInfoRegistry.get(De 
>>> f
>>> a
>>> ultXMLBeanInfoRegistry.java:88)
>>> at
>>> org.apache.commons.betwixt.XMLIntrospector.introspect(XMLIntrospector 
>>> .
>>> j
>>> ava:326)
>>> at
>>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.getElementDe 
>>> s
>>> c
>>> riptor(BeanRuleSet.java:448)
>>> at
>>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addChildRule 
>>> s
>>> (
>>> BeanRuleSet.java:307)
>>> at
>>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(Bean 
>>> R
>>> u
>>> leSet.java:515)
>>> at
>>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(Bean 
>>> R
>>> u
>>> leSet.java:495)
>>> at
>>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addChildRule 
>>> s
>>> (
>>> BeanRuleSet.java:402)
>>> at
>>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(Bean 
>>> R
>>> u
>>> leSet.java:515)
>>> at
>>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(Bean 
>>> R
>>> u
>>> leSet.java:495)
>>> at
>>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addChildRule 
>>> s
>>> (
>>> BeanRuleSet.java:402)
>>> at
>>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(Bean 
>>> R
>>> u
>>> leSet.java:515)
>>> at
>>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(Bean 
>>> R
>>> u
>>> leSet.java:495)
>>> at
>>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addChildRule 
>>> s
>>> (
>>> BeanRuleSet.java:402)
>>> ...
>>>
>>>
>>>
>>> ---------------------------------
>>> Do you Yahoo!?
>>> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------
>> Do you Yahoo!?
>> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message