RFR: JDK-8305710: Line breaks in search tags cause invalid JSON in index file [v2]
Hannes Wallnöfer
hannesw at openjdk.org
Wed May 17 10:14:07 UTC 2023
> 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.
Hannes Wallnöfer has updated the pull request incrementally with one additional commit since the last revision:
Fix test
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/14016/files
- new: https://git.openjdk.org/jdk/pull/14016/files/7a10b754..db501a82
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=14016&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=14016&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/14016.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14016/head:pull/14016
PR: https://git.openjdk.org/jdk/pull/14016
More information about the javadoc-dev
mailing list