IndexOutOfBoundsException when comparing documents with varying header/footer options

Hello,

Aspose Words fails with “IndexOutOfBoundsException” when using compare method on documents with varying header/footer “link to previous” option:

// Document A

Document documentA = new Document();
DocumentBuilder builder = new DocumentBuilder(documentA);

Section currentSection = builder.getCurrentSection();
PageSetup pageSetup = currentSection.getPageSetup();
pageSetup.setDifferentFirstPageHeaderFooter(false);

builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);
builder.writeln("H/F PRIM");
builder.moveToHeaderFooter(HeaderFooterType.HEADER_FIRST);
builder.writeln("H/F FP");

builder.moveToDocumentEnd();
builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);

currentSection = builder.getCurrentSection();
pageSetup = currentSection.getPageSetup();
pageSetup.setDifferentFirstPageHeaderFooter(true);

documentA.getSections().get(1).getHeadersFooters().linkToPrevious(false);

// Document B

Document documentB = new Document();
builder = new DocumentBuilder(documentB);

currentSection = builder.getCurrentSection();
pageSetup = currentSection.getPageSetup();
pageSetup.setDifferentFirstPageHeaderFooter(false);

builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);
builder.writeln("H/F PRIM");
builder.moveToHeaderFooter(HeaderFooterType.HEADER_FIRST);
builder.writeln("H/F FP");

builder.moveToDocumentEnd();
builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);

currentSection = builder.getCurrentSection();
pageSetup = currentSection.getPageSetup();
pageSetup.setDifferentFirstPageHeaderFooter(true);

documentB.getSections().get(1).getHeadersFooters().linkToPrevious(true);

// Comparison

documentA.compare(documentB, "Author", Calendar.getInstance().getTime()); // --> Exception

@PROCUREMENT2
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-25459

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

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