NullPointerException in LayoutCollector

Hi,


I’ve encountered several customer documents which are causing an NPE in LayoutCollector.getStartPageIndex(). I have managed to reproduce this using Aspose Words 17.6. A similar exception also occurs in getEndPageIndex().

Please find attached a document to recreate the issue using the following code:

License license = new License();
license.setLicense(“Aspose.Total.Java.lic”);

Document document = new Document(“conditional field.docx”);

LayoutCollector layoutCollector = new LayoutCollector(document);

for (Node node : (Iterable) document.getChildNodes(NodeType.PARAGRAPH, true)) {
if (node.getAncestor(NodeType.HEADER_FOOTER) == null) {
layoutCollector.getStartPageIndex(node);
layoutCollector.getEndPageIndex(node);
}
}
Cheers,
Simon

Hi Simon,


Thanks for your inquiry. We have tested the scenario and noticed the reported exception, so we have logged a ticket WORDSJAVA-1602 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

Best Regards,

@JavaDev01,

The issues you have found earlier (filed as WORDSJAVA-1602) have been fixed in this Aspose.Words for .NET 17.9 update and this Aspose.Words for Java 17.9 update.