On Fri, 20 Aug 2021 10:48:10 GMT, Pavel Rappo <[email protected]> wrote:
>> Could you please review the 8248001 bug fixes?
>>
>> The problem is that javadoc generates invalid HTML pages whose ftp:// links
>> are broken. The fix changes not to use protocol names directly, but to use
>> regular expression.
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
> line 1703:
>
>> 1701: return text;
>> 1702: }
>> 1703: if (text.matches("^[^:/?#]+:.+$")) {
>
> Why not use `java.net.URI` API to determine if the link contains a scheme?
I assume the link is in an HTML document and goes in an HTML document. If you
wanted to use java.net.URI, depending on where from `text` comes from and
whereto it goes, you might need first to decode it using URLDecoder, and then
you might need to re-encode it before spitting it out... That's a lot of
operations where things could go wrong, especially if the link contains a query
string.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5198