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 Tue, 13 Jan 2004 22:05:52 GMT
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 <robertburrelldonkin@blueyonder.co.uk> 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(Def 
>> a
>> ultXMLBeanInfoRegistry.java:88)
>> at
>> org.apache.commons.betwixt.XMLIntrospector.introspect(XMLIntrospector. 
>> j
>> ava:326)
>> at
>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.getElementDes 
>> c
>> riptor(BeanRuleSet.java:448)
>> at
>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addChildRules 
>> (
>> BeanRuleSet.java:307)
>> at
>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(BeanR 
>> u
>> leSet.java:515)
>> at
>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(BeanR 
>> u
>> leSet.java:495)
>> at
>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addChildRules 
>> (
>> BeanRuleSet.java:402)
>> at
>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(BeanR 
>> u
>> leSet.java:515)
>> at
>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(BeanR 
>> u
>> leSet.java:495)
>> at
>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addChildRules 
>> (
>> BeanRuleSet.java:402)
>> at
>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(BeanR 
>> u
>> leSet.java:515)
>> at
>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addRule(BeanR 
>> u
>> leSet.java:495)
>> at
>> org.apache.commons.betwixt.io.BeanRuleSet$ReadingContext.addChildRules 
>> (
>> 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


Mime
View raw message