GroupDocs.Comparison for Java 26.10 Release Notes

Full list of changes in this release

IDSummaryCategory
COMPARISONNET-4866, COMPARISONNET-4881External resources referenced by a document are no longer loaded by default; new LoadOptions settings control itFeature
COMPARISONJAVA-1667Applying changes to a .html file writes the HTML report again on Java 9 and laterFix
COMPARISONJAVA-1674A temp directory that is a symbolic link (/tmp on macOS) no longer fails with FileAlreadyExistsExceptionFix
COMPARISONNET-4892, COMPARISONNET-4893Faster PDF result rendering; duplicated and interleaved characters in the PDF result fixedFix
COMPARISONNET-2370PDF table cells keep their own line breaks, and text added by the comparison stays inside the cellFix
COMPARISONNET-4911Side-by-side PDF comparison no longer reports content pushed onto the next page as deleted and re-insertedFix
COMPARISONNET-4896Inline PDF comparison no longer draws lines that moved to another position on top of other linesFix
COMPARISONNET-4883, COMPARISONNET-4887Slides and Words comparison no longer fails on a picture that carries no image dataFix
COMPARISONNET-4773RevisionHandler closes the stream it opened, and takes a leaveOpen flag for a stream the caller passes inUpdate
COMPARISONJAVAWordCompareOptions.isWordTrackChanges() follows the display modeUpdate
COMPARISONNET-4878File type detection no longer labels a stream as EPUB just because it can be opened as oneUpdate
COMPARISONJAVA-1774Published POM: a short product description, plus <organization> and <scm>Update
COMPARISONJAVA-1791The license agreement and links in the distribution package point at addresses that existUpdate

Behaviour changes to check before upgrading

Three changes alter what existing code observes. Each is described in its own section below.

  • External resources are not loaded unless LoadOptions.setSkipExternalResources(false) is set.
  • new RevisionHandler(InputStream, FileType) now closes the stream when the handler is closed. Pass leaveOpen = true to keep it.
  • WordCompareOptions.isWordTrackChanges() now returns true for a new instance, following the default display mode REVISIONS.

Feature — control over loading external resources

A document can reference resources outside itself — for example an image given by a remote URL. Opening it used to make the comparison fetch that address. External resources are now skipped by default, and two LoadOptions settings control the behaviour:

  • setSkipExternalResources(boolean) — true by default; set false to load external resources.
  • setWhitelistedResources(List<String>) — URL fragments that are still loaded while resources are skipped.
LoadOptions loadOptions = new LoadOptions();
loadOptions.setSkipExternalResources(true);
loadOptions.setWhitelistedResources(Arrays.asList("includepicture-field.png"));

try (Comparer comparer = new Comparer("source.docx", loadOptions)) {
    comparer.add("target.docx", loadOptions);
    comparer.compare("result.docx");
}

For HTML documents, scripts, forms and navigation targets (<script src>, links, <form action>) are never dereferenced during comparison, regardless of these settings — nothing needs them to render or compare a page.

Scope.

  • Applies to HTML, Word and presentation documents.
  • Documents that rely on remote images now compare without them unless the resource is whitelisted or external loading is enabled. (COMPARISONNET-4866, COMPARISONNET-4881)

Fix — HTML report not written for a .html result on Java 9 and later

Comparing text-based documents such as JSON and applying changes to a file named .html wrote the compared text into it instead of the HTML report:

try (Comparer comparer = new Comparer("source.json")) {
    comparer.add("target.json");
    comparer.compare(new CompareOptions.Builder().setGenerateSummaryPage(false).build());
    ChangeInfo[] changes = comparer.getChanges();
    comparer.applyChanges("result.html", new ApplyChangeOptions(changes));  // now the HTML report
}

The result chooses the HTML report from the output file name. On Java 9 and later that name could not be read from the file stream, so the choice was silently skipped. The library now keeps the path of every file it opens itself.

Scope.

  • Affects Java 9 and later; Java 8 was not affected.
  • The number of detected changes was always correct — only what was saved differed. (COMPARISONJAVA-1667)

On macOS /tmp is a symbolic link to /private/tmp. With java.io.tmpdir set to /tmp, creating a Comparer failed with:

java.nio.file.FileAlreadyExistsException: /tmp : Can't create temp file!

Files.createDirectories rejects an existing path that is a link to a directory. A directory reached through a link is now used as it is.

Scope.

  • Affects any platform where java.io.tmpdir points at a symbolic link; the macOS default /var/folders/.../T is not affected.
  • On earlier versions, point java.io.tmpdir at the real directory, for example -Djava.io.tmpdir=/private/tmp. (COMPARISONJAVA-1674)

Fix — PDF result rendering: speed, and duplicated or interleaved characters

The PDF result was built by drawing every text segment as a separate fragment. Segments are much finer than words — a PDF that stores characters separately yields one segment per character — and the cost of adding a fragment grows with the content already on the page, so rendering slowed down sharply on such documents. Consecutive segments with the same formatting are now drawn as one fragment.

Drawing segments one by one also misplaced characters. Words could appear twice or run into their neighbours, for example:

beforeafter
self self--explanatoryexplanatoryself-explanatory self-explanatory
was releasedreleased forwas released for

Scope.

  • Affects the PDF comparison result document; detected changes are unchanged. (COMPARISONNET-4892, COMPARISONNET-4893)

Fix — line breaks inside PDF table cells

Text in a PDF table cell was wrapped against the width of the page rather than the cell. The cell’s own line breaks were merged into one long line, and text added by the comparison overflowed the cell. Paragraphs in table cells now keep their source line breaks and wrap at the cell edge, including merged cells. (COMPARISONNET-2370)

Fix — side-by-side PDF comparison across page breaks

Side-by-side and interleaved results compared page N of the source with page N of the target. When an edit pushed content onto the next page, everything that moved was reported deleted on one page and inserted on the next, often as letter-sized fragments where the two pages happened to share characters.

The text of the two documents is now compared as a whole, and each change is highlighted on the page where it is. Content that only moved to another page is not marked, and changes are highlighted by whole words. Pages are still shown side by side in the same order as before.

Scope.

  • Affects PdfCompareOptions display modes SIDE_BY_SIDE and INTERLEAVED; INLINE is unchanged.
  • Comparing large documents is also faster, since unchanged pages no longer produce thousands of highlights. (COMPARISONNET-4911)

Fix — inline PDF result drawing moved lines over other lines

In an inline PDF result, an unchanged line that moved to another position — for example to the bottom of the next page after text was inserted above it — could be drawn where it used to be in the source, on top of the line that now occupies that place. The two copies of the line differed in height only by rounding, and that was taken as a reason to use the source’s position. Such a line now stays where it is in the target document. (COMPARISONNET-4896)

Fix — picture without image data

Comparing presentations or Word documents failed with a NullPointerException when a picture frame or control carried a picture with no image data. Such pictures are now compared without their image bytes. (COMPARISONNET-4883, COMPARISONNET-4887)

Update — RevisionHandler stream ownership

RevisionHandler never closed the stream it opened itself when given a file path, so each such handler left a file open. It now closes it.

A new constructor states who owns a stream passed in:

try (InputStream stream = Files.newInputStream(path);
     RevisionHandler handler = new RevisionHandler(stream, FileType.DOCX, true)) {  // leaveOpen
    List<RevisionInfo> revisions = handler.getRevisions();
}
// stream is still open here

Scope.

  • Behaviour change: new RevisionHandler(InputStream, FileType) now closes the stream when the handler is closed. Pass leaveOpen = true to keep the stream open, as before. This matches GroupDocs.Comparison for .NET. (COMPARISONNET-4773)

Update — WordCompareOptions.isWordTrackChanges() follows the display mode

isWordTrackChanges() was kept separately from the display mode, so a new WordCompareOptions reported display mode REVISIONS and Track Changes off at the same time. It is now derived from the display mode, as in GroupDocs.Comparison for .NET. setWordTrackChanges(true) selects REVISIONS, and setWordTrackChanges(false) selects HIGHLIGHT.

Scope.

  • Behaviour change: isWordTrackChanges() returns true for a new WordCompareOptions, following the default display mode. (COMPARISONJAVA)

Update — EPUB detection

File type detection tried to open any otherwise unrecognised stream as EPUB and treated success as proof that the stream was EPUB. That check is removed, as in GroupDocs.Comparison for .NET. EPUB is not a supported comparison format, so this affects only how unrecognised input is reported. (COMPARISONNET-4878)

Update — published artifact metadata

The published POM now carries a short, product-specific description instead of a long feature list, and declares <organization> and <scm>. This is what dependency indexes such as MVNRepository display. Metadata only — no code, behaviour or API changed. (COMPARISONJAVA-1774)

The license agreement shipped in the distribution package redirected to an address that no longer exists. It now opens the GroupDocs License Agreement. The product page, documentation and examples links in readme.txt and the package shortcuts were updated the same way. Package contents only — no code, behaviour or API changed. (COMPARISONJAVA-1791)

Resources