mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8322874: Redirection loop in index.html
Reviewed-by: hannesw
This commit is contained in:
parent
d70156d2e2
commit
b3e0587ea0
@ -342,9 +342,6 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
* if only classes are provided on the command line.
|
||||
*/
|
||||
protected void setTopFile() {
|
||||
if (!checkForDeprecation()) {
|
||||
return;
|
||||
}
|
||||
if (options.createOverview()) {
|
||||
topFile = DocPaths.INDEX;
|
||||
} else {
|
||||
@ -368,15 +365,6 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean checkForDeprecation() {
|
||||
for (TypeElement te : getIncludedTypeElements()) {
|
||||
if (isGeneratedDoc(te)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate "overview.html" page if option "-overview" is used or number of
|
||||
* packages is more than one. Sets {@code HtmlOptions.createOverview} field to true.
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Head;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
@ -65,6 +66,8 @@ public class IndexRedirectWriter extends HtmlDocletWriter {
|
||||
|
||||
private IndexRedirectWriter(HtmlConfiguration configuration, DocPath filename, DocPath target) {
|
||||
super(configuration, filename);
|
||||
assert target != null && !target.isEmpty() && !Objects.equals(target, filename)
|
||||
: "target: '" + target.getPath() + "'";
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8322874
|
||||
* @summary Redirection loop in index.html
|
||||
* @library /tools/lib ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build javadoc.tester.* toolbox.ToolBox builder.ClassBuilder
|
||||
* @run main TestIndexRedirect
|
||||
*/
|
||||
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import toolbox.ToolBox;
|
||||
|
||||
import javadoc.tester.JavadocTester;
|
||||
|
||||
public class TestIndexRedirect extends JavadocTester {
|
||||
|
||||
final ToolBox tb = new ToolBox();
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
var tester = new TestIndexRedirect();
|
||||
tester.runTests();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
Path api = base.resolve("api");
|
||||
|
||||
tb.writeJavaFiles(src,
|
||||
"/** Module m. */ module m { requires java.se; }");
|
||||
|
||||
javadoc("-d", api.toString(),
|
||||
"--source-path", src.toString(),
|
||||
"--module", "m");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
checkOutput("index.html", true,
|
||||
"<script type=\"text/javascript\">window.location.replace('m/module-summary.html')</script>",
|
||||
"<meta http-equiv=\"Refresh\" content=\"0;m/module-summary.html\">"
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user