Skip to content

Conversation

@ortizman
Copy link

With this template engine, the library can process docx with many more scripts
Fix #21

@ortizman
Copy link
Author

@snowindy

@snowindy
Copy link
Owner

Thank you for the contribution, I will check it and try to merge if it's alright!

@snowindy
Copy link
Owner

snowindy commented Mar 3, 2019

Hi!
Sorry for being late! Could you please give me an example document that gives "Method code too large!" error?

I think that manually adding BREAK tag somewhere in a document is a hack and it gives bad user experience. That is, if you are new library user, you won't know this, and just think it's malfunctioning.

I think I can invent a way to avoid error "Method code too large!" without it, with your example to reproduce.

DocxTemplateBulk success test
DocxTemplate fail test (expected runtimeexception)
@ortizman
Copy link
Author

ortizman commented Mar 4, 2019

Hi!
Sorry for being late! Could you please give me an example document that gives "Method code too large!" error?

I think that manually adding BREAK tag somewhere in a document is a hack and it gives bad user experience. That is, if you are new library user, you won't know this, and just think it's malfunctioning.

I think I can invent a way to avoid error "Method code too large!" without it, with your example to reproduce.

@snowindy
I created a unity test to reproduce the limitation. DocxTemplateBulk passes it and DocxTemplate does not (expected=RuntimeException.class)
I really tried not to add the BREAK. But I can't imagine an alternative that doesn't require breaking the document and processing it in parts, since it is a limitation of the JVM.
https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.9.1

An alternative would be to process the document in parts in a way that is transparent to the client of the library. But this leads to the problem of knowing where to make the cut without breaking any scriptlet.

At the moment this hack is being used productively in several documents, many larger than the test file, without drawbacks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants