mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-28 15:51:02 +00:00
8195805: Doclet incorrectly updates all attributes in <a> tags when relocating links
Reviewed-by: ksrini
This commit is contained in:
parent
8550a5c92d
commit
c0cb471231
@ -1752,8 +1752,9 @@ public class HtmlDocletWriter {
|
||||
result.addContent(sb);
|
||||
Content docRootContent = new ContentBuilder();
|
||||
|
||||
boolean isHRef = inAnAtag() && node.getName().toString().equalsIgnoreCase("href");
|
||||
for (DocTree dt : node.getValue()) {
|
||||
if (utils.isText(dt) && inAnAtag()) {
|
||||
if (utils.isText(dt) && isHRef) {
|
||||
String text = ((TextTree) dt).getBody();
|
||||
if (text.startsWith("/..") && !configuration.docrootparent.isEmpty()) {
|
||||
result.addContent(configuration.docrootparent);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4460354 8014636 8043186
|
||||
* @bug 4460354 8014636 8043186 8195805
|
||||
* @summary Test to make sure that relative paths are redirected in the
|
||||
* output so that they are not broken.
|
||||
* @author jamieh
|
||||
@ -67,7 +67,12 @@ public class TestRelativeLinks extends JavadocTester {
|
||||
"<a href=\"./pkg/relative-field-link.html\">relative field link</a>",
|
||||
"<a href=\"./pkg/relative-method-link.html\">relative method link</a>",
|
||||
"<a href=\"./pkg/relative-package-link.html\">relative package link</a>",
|
||||
" <a href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>.",
|
||||
" <a href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>.");
|
||||
|
||||
// This is not a relative path and should not be redirected.
|
||||
checkOutput("index-all.html", true,
|
||||
"<div class=\"block\"><a name=\"masters\"></a>");
|
||||
checkOutput("index-all.html", false,
|
||||
"<div class=\"block\"><a name=\"./pkg/masters\"></a>");
|
||||
|
||||
// PACKAGE USE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user