Error "Cannot insert a node of this type at this location" using DocumentBuilder.insertDocument()

Hello everyone,

I have a problem if I try to import a document into another using DocumentBuilder.insertDocument().
The system returns this error “Cannot insert a node of this type at this location”.
I use Aspose Words for Java version 21.9 jdk17. Before this version I used the version 19.11 jdk16.
Using the 19.11, the error does not occur.
I tried to install the version 21.12 jdk17, but the error persists. At the moment I am not the possibility to install the version 22.1

I attached a little project where I have reproduced the issue.
Into the project there is the TestImportDocument class, for reproduce the issue, it is necessary run the “testSectionBreak” test.
IMPORTANT: I runned it with my licence, but into the project there is a empty file. It is necessary replace it with a valide licence.

Could you help me to understand if this bug is a regression or not? If not what could be the root cause of the issue?

Thanks for collaboration.
Regards,
Giulio Andolfi

TestForAspose.zip (79.2 KB)

@giulio.andolfi Thank you for reporting the problem to us. I have logged it as WORDSNET-23299. We will keep you informed and let you know once it is resolved.
It seems the problem occurs because there is a structured document tag with section break at the very beginning of your part document.

Hello @alexey.noskov,
thank you for your feedback.
I hope that the fix will be done into the next release.
Thanks,
Giulio

@giulio.andolfi Unfortunately, currently I cannot promise you a fast fix, the issue is currently in a que for analysis. Once our developers analyze the problem we will provide you more information.

Hello @alexey.noskov,
I saw that the issue’s status is changed.
Do you have some news?
Sorry, but we have some customers that have this problem and ask us a date for the fix. We need to reply them as soon as possible.
Thanks,
Giulio

@giulio.andolfi The fix is already implemented and will be integrated once it passes review stage. We will keep you informed and let you know once the version with the fix is available.

The issues you have found earlier (filed as WORDSNET-23299) have been fixed in this Aspose.Words for Java 22.2 update.

I tested the new versione and now works fine.
Thanks,
Giulio