We are experiencing a stackoverflowerror when calling MailMerge.getFieldNames() for example.docx in the stackOverflowError Aspose Word.zip (29.4 KB)
attached example project.
We have end-users creating mail merge templates and we do not want to confront them with a stackoverflowerror when they’re doing the actual mailmerge.
Would it be possible for you to investigate this issue?
Many thanks.
Exception in thread "main" java.lang.StackOverflowError
at java.base/java.util.regex.Pattern$GroupTail.match(Pattern.java:4841)
at java.base/java.util.regex.Pattern$BranchConn.match(Pattern.java:4700)
at java.base/java.util.regex.Pattern$CharProperty.match(Pattern.java:3927)
at java.base/java.util.regex.Pattern$Branch.match(Pattern.java:4736)
at java.base/java.util.regex.Pattern$GroupHead.match(Pattern.java:4791)
at java.base/java.util.regex.Pattern$Loop.match(Pattern.java:4928)
at java.base/java.util.regex.Pattern$GroupTail.match(Pattern.java:4850)
at java.base/java.util.regex.Pattern$BranchConn.match(Pattern.java:4700)
at java.base/java.util.regex.Pattern$CharProperty.match(Pattern.java:3927)
at java.base/java.util.regex.Pattern$Branch.match(Pattern.java:4736)
at java.base/java.util.regex.Pattern$GroupHead.match(Pattern.java:4791)
at java.base/java.util.regex.Pattern$Loop.match(Pattern.java:4928) ....
We have tested the scenario using the latest version of Aspose.Words for Java 20.2 and have not found the shared issue. So, please use Aspose.Words for Java 20.2.
Thanks for the quick reply. However, I am able to reproduce the error with version 20.2.
I found out that it depends on the configured maximum stack size for the Java process. If I set the stack size to 1MB ( -Xss1m ) I can reproduce this stackoverflowerror.
I cannot imagine it is correct behavior to have a 1MB stack for such a small document like the one attached. Also, in example.docx if the text after the field (which is missing the end } ) is enlarged (example-larger.zip (14.3 KB))the issue can also reproduced with larger stack sizes ( larger then 5MB).
For your convenience follows the bottom of the stacktrace:
Please share the complete steps that you are using to reproduce this issue at our end. Please also share your working environment e.g. operating system, Java version etc.
Please create a simple Java application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing. Thanks for your cooperation.
Thanks for sharing the detail. It would be great if you please ZIP and attach your idea.vmoptions file. We will use the same setting as of yours for testing. Thanks for your cooperation.
We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSJAVA-2324. You will be notified via this forum thread once this issue is resolved.
Could you please share the answer to following questions for further analysis?
Please share why you need to limit Stack Size specifically.
Please share example document consist from one super big paragraph. Do you have end-users that compose merge templates with 19420 words in the single paragraph?