Page 1 of 1

PropertyResolver StackOverflowError

PostPosted: Tue Apr 06, 2010 12:36 am
by horstdieter2
Thank you.

But now i've got another problem:

I checked out the new version docx4j-nightly-20100405.jar.

If i run my program there will be the followed exception:

Code: Select all
Exception in thread "AWT-EventQueue-1" java.lang.StackOverflowError
   at java.util.HashMap.get(Unknown Source)
   at org.docx4j.model.PropertyResolver.fillPPrStack(PropertyResolver.java:1068)


log4j:

Code: Select all
...
14:51:00,605  INFO StyleDefinitionsPart:374 - Style with name Normal, id 'Standard' is default paragraph style
14:51:00,605  INFO StyleDefinitionsPart:374 - Style with name Default Paragraph Font, id 'Absatz-Standardschriftart' is default character style
14:51:00,606 DEBUG PropertyResolver:1128 - initialiseLiveStyles()
14:51:00,606 DEBUG PropertyResolver:1078 - Added Standard to pPr stack
14:51:00,609 DEBUG PropertyResolver:1078 - Added Standard to pPr stack
14:51:00,609 DEBUG PropertyResolver:1078 - Added Standard to pPr stack
...infinite  loop...


In revision 1096 you've changed this class.
I tried out an earlier version of the PropertyResolver class (v. 2.3.0) and my program works.

Re: PropertyResolver StackOverflowError

PostPosted: Tue Apr 06, 2010 10:17 am
by jason
[I split this topic from the earlier one.] At a glance, it looks like your definition of style with name Normal, id 'Standard' is basedOn itself. Could you please eyeball your styles part, and confirm this? If not, please attach your document to this topic.

A style should not be basedOn itself.

It would be easy enough to add a check that A is not basedOn A, but one could construct other loops eg A basedOn B which is basedOn A the checking of which would consume more processing time. So I'm considering how far to go with such checks.

Did you make this document programmatically (eg with docx4j), or how?

cheers .. Jason

Re: PropertyResolver StackOverflowError

PostPosted: Tue Apr 06, 2010 7:43 pm
by horstdieter2
You're right.

I've created a style named 'Standard' in my application which is based on the default Microsoft Word style 'Standard' (german version). Now i check this.

I would implement the easy check and throw an exception with an corresponding error message for greater loops (A->B->A).

I actually try to convert a complex OpenOffice-document maker application into the docx format with docx4j. It could be that my postcounter will increase in the next months ;)

Re: PropertyResolver StackOverflowError

PostPosted: Thu Apr 08, 2010 12:31 pm
by jason
No worries - I look forward to your posts!