On Tue, 16 May 2023 15:04:27 GMT, Hannes Wallnöfer <hann...@openjdk.org> wrote:
> This fixes a number of issues that can or could result in invalid JavaScript > search index files, and a single invalid index file breaking the whole > JavaDoc search feature. > > - The `IndexItem` now throws `IllegalArgumentException` if the label > argument contains a line break. This was the original cause for this bug and > was already fixed in > [JDK-8305407](https://bugs.openjdk.org/browse/JDK-8305407), but it is a good > idea to add the explicit check to fail in a visible way should it occur again. > - The `IndexItem.escapeQuotes(String)` method now escapes backslashes in > addition to quote. Failure to escape a trailing backslash would result in an > escaped quote, leading to an invalid index file. > - The search script gets a check for null/undefined to avoid a missing tag > index file to break the search feature as a whole. > > Note that the added test covers only the second item in the list above. The > other two changes are trivial and would require undue effort to test. > > I also removed a few `boolean` parameters from test methods in > `TestSearch.java` that are always called with `true` as value. This pull request has now been integrated. Changeset: 3272e259 Author: Hannes Wallnöfer <hann...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/3272e2597ac1176353bea33fb59e2938395bdb3f Stats: 74 lines in 4 files changed: 45 ins; 6 del; 23 mod 8305710: Line breaks in search tags cause invalid JSON in index file Reviewed-by: jjg ------------- PR: https://git.openjdk.org/jdk/pull/14016