| Author |
stackOverFlow with XMLWriter.write
|
Anand Krishnanandam
Greenhorn
Joined: May 23, 2006
Posts: 25
|
|
Hi, I get a stackOverFlow error while executing this code. And writer.write(fooXML) leads to : Caused by: java.lang.StackOverflowError at java.nio.Buffer.<init>(Unknown Source) at java.nio.CharBuffer.<init>(Unknown Source) at java.nio.HeapCharBuffer.<init>(Unknown Source) at java.nio.CharBuffer.wrap(Unknown Source) at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(Unknown Source) at sun.nio.cs.StreamEncoder.write(Unknown Source) at java.io.OutputStreamWriter.write(Unknown Source) at java.io.BufferedWriter.flushBuffer(Unknown Source) at java.io.BufferedWriter.write(Unknown Source) at java.io.Writer.write(Unknown Source) at org.dom4j.io.XMLWriter.indent(XMLWriter.java:1531) at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:904) at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301) at org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086) at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954) at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301) at org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086) at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954) at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301) at org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086) at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954) at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301) at org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086) at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954) at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301) at org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086) at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954) at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301) at org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086) at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954) at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301) at org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086) Thanks for the help.
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
|
It appears that the structure of your XML document is very deeply nested.
|
 |
Anand Krishnanandam
Greenhorn
Joined: May 23, 2006
Posts: 25
|
|
I thought it could be the problem of back referencing in the mapping...But how do I investigate it?? I have the following code, with the help of jxpath (ElementWrapper is Hibernate class that Wraps dom4j elements) I'm trying to go deeper in the nodes to see if there is a possible back reference that go in to an infinite loop. Any other way that I can find whats going wrong?? Thanks, Anand
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
|
Infinite loop seems like a good bet to me.
|
 |
Anand Krishnanandam
Greenhorn
Joined: May 23, 2006
Posts: 25
|
|
sorry, I forgot to add. The above code snippet creates the following output: �622-***********: id-*****- 368563 �622-***********: version-*****- 39 �622-***********: name-*****- simpson �622-***********: firstName-*****- bart �622-***********: phoneCountryCode-*****- 66 �622-***********: phone-*****- 11-111-1111 �622-***********: phoneOnlyNumeric-*****- 1111111111 �622-***********: mobilePhone-*****- 11-111-1111 �622-***********: mobilePhoneCountryCode-*****- 66 �622-***********: email-*****- bart@hotmail.com �622-***********: middleName-*****- - �622-***********: whenBorn-*****- 1111-04-08 00:00:00 �622-***********: isActive-*****- true �622-***********: whenCreated-*****- 1111-02-25 00:35:00 �622-***********: createdBy-*****- 1 �622-***********: whenModified-*****- 1111-03-30 04:57:03 �622-***********: modifiedBy-*****- 1111111 �622-***********: addresses-*****- �622-***********: emailAddresses-*****- �622-***********: flags-*****- �622-***********: password-*****- excuseme �637-***********: isOkToLogin-*****- true �637-***********: pwdToken-*****- ET2Z95P77ESSBAFB9QPB0RTW44HMM2EK �637-***********: whenLastGoodLogin-*****- 2008-06-16 05:18:00 �637-***********: isRegistered-*****- true �637-***********: birthCity-*****- Nakhon Phanom �637-***********: passportNbr-*****- q123456 �637-***********: bestTimeToCall-*****- any time �637-***********: altPhone-*****- 11-111-1111 �637-***********: altPhoneCountryCode-*****- 66 �637-***********: altPhoneBestTimeToCall-*****- anytime �637-***********: bestWayToContact-*****- �637-***********: isPrematched-*****- false �637-***********: otherHobbies-*****- My hobbies are aerobic , Music and Photpgraphy. And intersts are camping , drawing , swimming , table Tennis , Badminton, Baseball,travel,cooking. �637-***********: mobilePhoneBestTimeToCall-*****- anytime �637-***********: genderCode-*****- F �637-***********: isAPCLeadQualified-*****- false �637-***********: referredBy-*****- A Co., Ltd. �637-***********: qualifiedInfantSpecialized-*****- false �637-***********: circulatedInfantSpecialized-*****- false �637-***not a defaultElement-*****- howAppEnteredWebApp �637-***not a defaultElement-*****- extensionInfo �637-***not a defaultElement-*****- fooApp �637-***not a defaultElement-*****- religion �637-***not a defaultElement-*****- religiousFervor �637-***********: partner-*****- 29560 �637-***not a defaultElement-*****- country �637-***not a defaultElement-*****- country �637-***not a defaultElement-*****- country �637-***not a defaultElement-*****- country �637-***not a defaultElement-*****- country �637-***not a defaultElement-*****- nativeLanguage �637-***not a defaultElement-*****- departureGateway �637-***not a defaultElement-*****- status �637-***********: placements-*****- �637-***********: selections-*****-
|
 |
Anand Krishnanandam
Greenhorn
Joined: May 23, 2006
Posts: 25
|
|
I now could do a recursive call and went deep in to the element. The recursive call works fine and doesn't seem to go in to an infinite loop. Then why would a stckOverFlow happen?
|
 |
 |
|
|
subject: stackOverFlow with XMLWriter.write
|
|
|