RFR: JDK-8305710: Line breaks in search tags cause invalid JSON in index file [v2]

Jonathan Gibbons jjg at openjdk.org
Wed May 24 20:54:55 UTC 2023


On Wed, 17 May 2023 10:14:07 GMT, Hannes Wallnöfer <hannesw at 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.
>
> Hannes Wallnöfer has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix test

Marked as reviewed by jjg (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/14016#pullrequestreview-1442732298


More information about the javadoc-dev mailing list