erdos / stencil

templating engine for DOCX and PPTX files
https://stencil.erdos.dev
Eclipse Public License 2.0
111 stars 12 forks source link

Getting stackoverflow exception during parsing of template regarding whitespace parsing #149

Closed agrahl closed 1 year ago

agrahl commented 1 year ago

Describe the bug When we parse a template via the API.prepare(File file) method in Java, we get a StackOverflowException. This occurs with all version beginning with 0.5.1 and later. It seems that the whitespace parsing was changed in 0.5.1 fix: nonbreaking space in control (https://github.com/erdos/stencil/pull/141) which leads to this error.

java.lang.StackOverflowError at stencil.util$whitespace_QMARK_.invokeStatic(util.clj:137) at stencil.util$whitespace_QMARK_.invoke(util.clj:133) at stencil.util$whitespace_QMARK_.invokeStatic(util.clj:137) at stencil.util$whitespace_QMARK_.invoke(util.clj:133) ...

Office versions:

Environment where template is rendered:

erdos commented 1 year ago

Hey @agrahl I have just released 0.5.3 with a quick fix. Could you please test with this latest version works for you?


In the meanwhile I will continue debugging. It looks like the Clojure function was not inlined properly for some reason. Can you share some details on how you are using Stencil in your product?

agrahl commented 1 year ago

Hi @erdos , I use the library in Java. As build tool we use Maven.

Currently I just played around with it, when the problem occured I switched back to the 0.5.0 version, because I saw that there was a change in the code on this lines.

The template I test is very simple header footer include and a simple table.

I will try the 0.5.3 version next week.

Thanks in advanced for your quick fix.

Regards Alex

agrahl commented 1 year ago

Forgot to mention, the docker service instances beginning with 0.5.1 do also throw this error.

agrahl commented 1 year ago

Morning @erdos ,

I tested the new 0.5.3 version and here it works without problems. I do not get this StackOverflowException any more regarding the white space parsing. Thanks for the quick fix.

Regards

Alex

erdos commented 1 year ago

great to hear, thanks for the followup