RFR: 8248001: javadoc generates invalid HTML pages whose ftp:// links are broken [v2]

Masanori Yano myano at openjdk.java.net
Fri Sep 17 07:43:51 UTC 2021


On Mon, 13 Sep 2021 16:00:28 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> Masanori Yano has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>> 
>>  - 8248001: javadoc generates invalid HTML pages whose ftp:// links are broken
>>  - Merge branch 'master' of https://github.com/masyano/jdk into 8248001
>>  - 8248001: javadoc generates invalid HTML pages whose ftp:// links are broken
>>  - 8248001: javadoc generates invalid HTML pages whose ftp:// links are broken
>>  - 8248001: javadoc generates invalid HTML pages whose ftp:// links are broken
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java line 1706:
> 
>> 1704:                 || lower.startsWith("https:")
>> 1705:                 || lower.startsWith("file:")
>> 1706:                 || lower.startsWith("ftp:")) {
> 
> Adding `ftp:` is OK, but given that the method is about modifying relative URLs, a reasonable/preferable alternative would be to use `URI.isAbsolute`
> 
> If a `URISyntaxException` occurs while creating the URI, I would suggest it should simply `return text` and not try and modify the text.

The way to use java.net.URI API has already been discussed above. https://github.com/openjdk/jdk/pull/5198#discussion_r692852885

The method using regex has a security problem because it matches patterns other than ftp. So I adopted @hns 's suggestion.

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

PR: https://git.openjdk.java.net/jdk/pull/5198


More information about the javadoc-dev mailing list