Skip to content

Commit f5f17ec

Browse files
ktakakuriPaul Hohensee
authored and
Paul Hohensee
committed
8248001: javadoc generates invalid HTML pages whose ftp:// links are broken
Reviewed-by: phh Backport-of: bb95dda0ac5032e4df582f2903dcbbbbaef9e8c4
1 parent 2c54727 commit f5f17ec

File tree

3 files changed

+79
-3
lines changed

3 files changed

+79
-3
lines changed

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,8 @@ protected DocPath defaultAction(Element e, Void p) {
16281628
if (!(lower.startsWith("mailto:")
16291629
|| lower.startsWith("http:")
16301630
|| lower.startsWith("https:")
1631-
|| lower.startsWith("file:"))) {
1631+
|| lower.startsWith("file:")
1632+
|| lower.startsWith("ftp:"))) {
16321633
text = "{@" + (new DocRootTaglet()).getName() + "}/"
16331634
+ redirectPathFromRoot.resolve(text).getPath();
16341635
text = replaceDocRootDir(text);

test/langtools/jdk/javadoc/doclet/testHrefInDocComment/TestHrefInDocComment.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 4638015
26+
* @bug 4638015 8248001
2727
* @summary Determine if Hrefs are processed properly when they
2828
* appear in doc comments.
2929
* @author jamieh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
package pkg;
25+
26+
/**
27+
*This class has <a href="{@docRoot}/pkg/J1.html#functions">various functions</a>,
28+
* see <a href="ftp://www.example.com/">FTP Site</a>,
29+
* <a href="file:///path/to/somefile">file service</a> for further information
30+
*<a id="functions">various functions</a>
31+
*<ul>
32+
*<li>function1</li>
33+
*<li>function2</li>
34+
*<li>function3</li>
35+
*</ul>
36+
*<a id="methods">special methods</a>
37+
*<ul>
38+
*<li>method1</li>
39+
*<li>method2</li>
40+
*<li>method3</li>
41+
*</ul>
42+
*/
43+
public class J1 {
44+
/**
45+
*fields.
46+
*/
47+
protected Object field1;
48+
49+
/**
50+
*<a href="{@docRoot}/pkg/J1.html#functions">Creates an instance which has various functions.</a>
51+
*/
52+
public J1(){
53+
}
54+
55+
/**
56+
*This is a<a href="#methods">special method</a>.
57+
*@param p1 arg1
58+
*/
59+
public void method1(int p1){
60+
}
61+
62+
/**
63+
*See <a href="ftp://www.example.com/">FTP Site</a> for more information.
64+
*@param p1 arg1
65+
*/
66+
public void method2(int p1){
67+
}
68+
69+
/**
70+
*See <a href="file:///path/to/somefile">file service</a> for more information.
71+
*@param p1 arg1
72+
*/
73+
public void method3(int p1){
74+
}
75+
}

0 commit comments

Comments
 (0)