RFR: 8351332: Line breaks in search tag descriptions corrupt JSON search index
Chen Liang
liach at openjdk.org
Mon Mar 24 16:12:14 UTC 2025
On Mon, 24 Mar 2025 14:41:43 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:
> Please review this patch to fix an issue in the `tag-search-index.js` generation.
>
> The problem was in the `toJSON()` method of `IndexItem`. When adding the description, it's using `escapeQuotes(description)` which only escapes backslashes and quotes, but doesn't normalize whitespace.
>
> TIA
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexItem.java line 645:
> 643: if (!description.isEmpty()) {
> 644: String normalizedDescription = description.replaceAll("\\s+", " ");
> 645: builder.append("d", escapeQuotes(normalizedDescription));
Should we just handle all whitespaces in `escapeQuotes`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24202#discussion_r2010492415
More information about the javadoc-dev
mailing list