Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
bfc9f6c3
D
dragonwell8_langtools
项目概览
openanolis
/
dragonwell8_langtools
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_langtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bfc9f6c3
编写于
12月 03, 2013
作者:
B
bpatel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8025416: doclet not substituting {@docRoot} in some cases
Reviewed-by: jjg
上级
4dce1c43
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
123 addition
and
82 deletion
+123
-82
src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
.../com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
+33
-44
src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
.../com/sun/tools/doclets/formats/html/TagletWriterImpl.java
+1
-3
test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java
test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java
+56
-12
test/com/sun/javadoc/testDocRootLink/pkg1/C1.java
test/com/sun/javadoc/testDocRootLink/pkg1/C1.java
+7
-2
test/com/sun/javadoc/testDocRootLink/pkg1/package.html
test/com/sun/javadoc/testDocRootLink/pkg1/package.html
+9
-9
test/com/sun/javadoc/testDocRootLink/pkg2/C2.java
test/com/sun/javadoc/testDocRootLink/pkg2/C2.java
+8
-3
test/com/sun/javadoc/testDocRootLink/pkg2/package.html
test/com/sun/javadoc/testDocRootLink/pkg2/package.html
+9
-9
未找到文件。
src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
浏览文件 @
bfc9f6c3
...
...
@@ -148,43 +148,28 @@ public class HtmlDocletWriter extends HtmlDocWriter {
StringBuilder
buf
=
new
StringBuilder
();
int
previndex
=
0
;
while
(
true
)
{
if
(
configuration
.
docrootparent
.
length
()
>
0
)
{
final
String
docroot_parent
=
"{@docroot}/.."
;
// Search for lowercase version of {@docRoot}/..
index
=
lowerHtml
.
indexOf
(
docroot_parent
,
previndex
);
// If next {@docRoot}/.. pattern not found, append rest of htmlstr and exit loop
if
(
index
<
0
)
{
buf
.
append
(
htmlstr
.
substring
(
previndex
));
break
;
}
// If next {@docroot}/.. pattern found, append htmlstr up to start of tag
buf
.
append
(
htmlstr
.
substring
(
previndex
,
index
));
previndex
=
index
+
docroot_parent
.
length
();
// Insert docrootparent absolute path where {@docRoot}/.. was located
final
String
docroot
=
"{@docroot}"
;
// Search for lowercase version of {@docRoot}
index
=
lowerHtml
.
indexOf
(
docroot
,
previndex
);
// If next {@docRoot} tag not found, append rest of htmlstr and exit loop
if
(
index
<
0
)
{
buf
.
append
(
htmlstr
.
substring
(
previndex
));
break
;
}
// If next {@docroot} tag found, append htmlstr up to start of tag
buf
.
append
(
htmlstr
.
substring
(
previndex
,
index
));
previndex
=
index
+
docroot
.
length
();
if
(
configuration
.
docrootparent
.
length
()
>
0
&&
htmlstr
.
startsWith
(
"/.."
,
previndex
))
{
// Insert the absolute link if {@docRoot} is followed by "/..".
buf
.
append
(
configuration
.
docrootparent
);
// Append slash if next character is not a slash
if
(
previndex
<
htmlstr
.
length
()
&&
htmlstr
.
charAt
(
previndex
)
!=
'/'
)
{
buf
.
append
(
'/'
);
}
previndex
+=
3
;
}
else
{
final
String
docroot
=
"{@docroot}"
;
// Search for lowercase version of {@docRoot}
index
=
lowerHtml
.
indexOf
(
docroot
,
previndex
);
// If next {@docRoot} tag not found, append rest of htmlstr and exit loop
if
(
index
<
0
)
{
buf
.
append
(
htmlstr
.
substring
(
previndex
));
break
;
}
// If next {@docroot} tag found, append htmlstr up to start of tag
buf
.
append
(
htmlstr
.
substring
(
previndex
,
index
));
previndex
=
index
+
docroot
.
length
();
// Insert relative path where {@docRoot} was located
buf
.
append
(
pathToRoot
.
isEmpty
()
?
"."
:
pathToRoot
.
getPath
());
// Append slash if next character is not a slash
if
(
previndex
<
htmlstr
.
length
()
&&
htmlstr
.
charAt
(
previndex
)
!=
'/'
)
{
buf
.
append
(
'/'
);
}
}
// Append slash if next character is not a slash
if
(
previndex
<
htmlstr
.
length
()
&&
htmlstr
.
charAt
(
previndex
)
!=
'/'
)
{
buf
.
append
(
'/'
);
}
}
return
buf
.
toString
();
...
...
@@ -1604,26 +1589,30 @@ public class HtmlDocletWriter extends HtmlDocWriter {
result
.
addContent
(
seeTagToContent
((
SeeTag
)
tagelem
));
}
else
if
(!
tagName
.
equals
(
"Text"
))
{
boolean
wasEmpty
=
result
.
isEmpty
();
Content
output
=
TagletWriter
.
getInlineTagOuput
(
configuration
.
tagletManager
,
holderTag
,
tagelem
,
getTagletWriterInstance
(
isFirstSentence
));
Content
output
;
if
(
configuration
.
docrootparent
.
length
()
>
0
&&
tagelem
.
name
().
equals
(
"@docRoot"
)
&&
((
tags
[
i
+
1
]).
text
()).
startsWith
(
"/.."
))
{
// If Xdocrootparent switch ON, set the flag to remove the /.. occurrence after
// {@docRoot} tag in the very next Text tag.
textTagChange
=
true
;
// Replace the occurrence of {@docRoot}/.. with the absolute link.
output
=
new
StringContent
(
configuration
.
docrootparent
);
}
else
{
output
=
TagletWriter
.
getInlineTagOuput
(
configuration
.
tagletManager
,
holderTag
,
tagelem
,
getTagletWriterInstance
(
isFirstSentence
));
}
if
(
output
!=
null
)
result
.
addContent
(
output
);
if
(
wasEmpty
&&
isFirstSentence
&&
tagelem
.
name
().
equals
(
"@inheritDoc"
)
&&
!
result
.
isEmpty
())
{
break
;
}
else
if
(
configuration
.
docrootparent
.
length
()
>
0
&&
tagelem
.
name
().
equals
(
"@docRoot"
)
&&
((
tags
[
i
+
1
]).
text
()).
startsWith
(
"/.."
))
{
//If Xdocrootparent switch ON, set the flag to remove the /.. occurance after
//{@docRoot} tag in the very next Text tag.
textTagChange
=
true
;
continue
;
}
else
{
continue
;
}
}
else
{
String
text
=
tagelem
.
text
();
//If Xdocrootparent switch ON, remove the /.. occur
a
nce after {@docRoot} tag.
//If Xdocrootparent switch ON, remove the /.. occur
re
nce after {@docRoot} tag.
if
(
textTagChange
)
{
text
=
text
.
replaceFirst
(
"/.."
,
""
);
textTagChange
=
false
;
...
...
src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
浏览文件 @
bfc9f6c3
...
...
@@ -80,9 +80,7 @@ public class TagletWriterImpl extends TagletWriter {
*/
public
Content
getDocRootOutput
()
{
String
path
;
if
(
configuration
.
docrootparent
.
length
()
>
0
)
path
=
configuration
.
docrootparent
;
else
if
(
htmlWriter
.
pathToRoot
.
isEmpty
())
if
(
htmlWriter
.
pathToRoot
.
isEmpty
())
path
=
"."
;
else
path
=
htmlWriter
.
pathToRoot
.
getPath
();
...
...
test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java
浏览文件 @
bfc9f6c3
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
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 6553182
* @bug 6553182
8025416
* @summary This test verifies the -Xdocrootparent option.
* @author Bhavesh Patel
* @library ../lib/
...
...
@@ -35,43 +35,87 @@ public class TestDocRootLink extends JavadocTester {
private
static
final
String
BUG_ID
=
"6553182"
;
private
static
final
String
[][]
TEST1
=
{
{
BUG_ID
+
FS
+
"pkg1"
+
FS
+
"C1.html"
,
"<a href=\"../../technotes/guides/index.html\">"
"Refer <a href=\"../../technotes/guides/index.html\">Here</a>"
},
{
BUG_ID
+
FS
+
"pkg1"
+
FS
+
"C1.html"
,
"This <a href=\"../pkg2/C2.html\">Here</a> should not be replaced"
+
NL
+
" with an absolute link."
},
{
BUG_ID
+
FS
+
"pkg1"
+
FS
+
"C1.html"
,
"Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and"
+
NL
+
" <a href=\"../pkg2/C2.html\">Link 2</a>."
},
{
BUG_ID
+
FS
+
"pkg1"
+
FS
+
"package-summary.html"
,
"<a href=\"../../technotes/guides/index.html\">"
"<a href=\"../../technotes/guides/index.html\">"
+
NL
+
" Test document 1</a>"
},
{
BUG_ID
+
FS
+
"pkg1"
+
FS
+
"package-summary.html"
,
"<a href=\"../pkg2/C2.html\">"
+
NL
+
" Another Test document 1</a>"
},
{
BUG_ID
+
FS
+
"pkg1"
+
FS
+
"package-summary.html"
,
"<a href=\"../technotes/guides/index.html\">"
+
NL
+
" Another Test document 2.</a>"
}
};
private
static
final
String
[][]
NEGATED_TEST1
=
{
{
BUG_ID
+
FS
+
"pkg1"
+
FS
+
"C1.html"
,
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
},
{
BUG_ID
+
FS
+
"pkg1"
+
FS
+
"C1.html"
,
"<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
},
{
BUG_ID
+
FS
+
"pkg1"
+
FS
+
"package-summary.html"
,
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
},
{
BUG_ID
+
FS
+
"pkg1"
+
FS
+
"package-summary.html"
,
"<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
}
};
private
static
final
String
[][]
TEST2
=
{
{
BUG_ID
+
FS
+
"pkg2"
+
FS
+
"C2.html"
,
"
<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\"
>"
{
BUG_ID
+
"-1"
+
FS
+
"pkg2"
+
FS
+
"C2.html"
,
"
Refer <a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">Here</a
>"
},
{
BUG_ID
+
FS
+
"pkg2"
+
FS
+
"package-summary.html"
,
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
{
BUG_ID
+
"-1"
+
FS
+
"pkg2"
+
FS
+
"C2.html"
,
"This <a href=\"../pkg1/C1.html\">Here</a> should not be replaced"
+
NL
+
" with an absolute link."
},
{
BUG_ID
+
"-1"
+
FS
+
"pkg2"
+
FS
+
"C2.html"
,
"Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and"
+
NL
+
" <a href=\"../pkg1/C1.html\">Link 2</a>."
},
{
BUG_ID
+
"-1"
+
FS
+
"pkg2"
+
FS
+
"package-summary.html"
,
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
+
NL
+
" Test document 1</a>"
},
{
BUG_ID
+
"-1"
+
FS
+
"pkg2"
+
FS
+
"package-summary.html"
,
"<a href=\"../pkg1/C1.html\">"
+
NL
+
" Another Test document 1</a>"
},
{
BUG_ID
+
"-1"
+
FS
+
"pkg2"
+
FS
+
"package-summary.html"
,
"<a href=\"../technotes/guides/index.html\">"
+
NL
+
" Another Test document 2.</a>"
}
};
private
static
final
String
[][]
NEGATED_TEST2
=
{
{
BUG_ID
+
FS
+
"pkg2"
+
FS
+
"C2.html"
,
{
BUG_ID
+
"-1"
+
FS
+
"pkg2"
+
FS
+
"C2.html"
,
"<a href=\"../../technotes/guides/index.html\">"
},
{
BUG_ID
+
FS
+
"pkg2"
+
FS
+
"package-summary.html"
,
{
BUG_ID
+
"-1"
+
FS
+
"pkg2"
+
FS
+
"C2.html"
,
"<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">"
},
{
BUG_ID
+
"-1"
+
FS
+
"pkg2"
+
FS
+
"package-summary.html"
,
"<a href=\"../../technotes/guides/index.html\">"
},
{
BUG_ID
+
"-1"
+
FS
+
"pkg2"
+
FS
+
"package-summary.html"
,
"<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">"
}
};
private
static
final
String
[]
ARGS1
=
new
String
[]{
"-d"
,
BUG_ID
,
"-sourcepath"
,
SRC_DIR
,
"pkg1"
"-d"
,
BUG_ID
,
"-sourcepath"
,
SRC_DIR
,
"pkg1"
,
"pkg2"
};
private
static
final
String
[]
ARGS2
=
new
String
[]{
"-d"
,
BUG_ID
,
"-Xdocrootparent"
,
"http://download.oracle.com/javase/7/docs"
,
"-sourcepath"
,
SRC_DIR
,
"pkg2"
"-d"
,
BUG_ID
+
"-1"
,
"-Xdocrootparent"
,
"http://download.oracle.com/javase/7/docs"
,
"-sourcepath"
,
SRC_DIR
,
"pkg1"
,
"pkg2"
};
/**
...
...
test/com/sun/javadoc/testDocRootLink/pkg1/C1.java
浏览文件 @
bfc9f6c3
...
...
@@ -25,7 +25,12 @@ package pkg1;
/**
* Class 1. This is a test.
* Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a>. Lets see if this works
* or not.
* Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a>. This link should
* not be replaced with an absolute link.
* This <a href="{@docRoot}/pkg2/C2.html">Here</a> should not be replaced
* with an absolute link.
* Testing <a href="{@docRoot}/technotes/guides/index.html">Link 1</a> and
* <a href="{@docRoot}/pkg2/C2.html">Link 2</a>. 2 back-to-back links using
* docroot. These should not be replaced with an absolute link.
*/
public
class
C1
{}
test/com/sun/javadoc/testDocRootLink/pkg1/package.html
浏览文件 @
bfc9f6c3
...
...
@@ -3,16 +3,16 @@
<title>
javax.management package
</title>
</head>
<body
bgcolor=
"white"
>
This is a test.
<p
id=
"spec"
>
@see
<a
href=
"{@docRoot}/../technotes/guides/index.html"
>
Test document 1
</a>
in particular the
<a
href=
"{@docRoot}/../technotes/guides/index.html"
>
This is a test.
<p
id=
"spec"
>
@see
<a
href=
"{@docRoot}/../technotes/guides/index.html"
>
Test document 1
</a>
should not be replaced with an absolute link.
@see
<a
href=
"{@docRoot}/pkg2/C2.html"
>
Another Test document 1
</a>
which should not be replaced with an absolute link.
<a
href=
"{@docRoot}/technotes/guides/index.html"
>
Another Test document 2.
</a>
which should not be replaced with an absolute link.
Test document 2.
</a>
@since 1.5
@since 1.5
</body>
</html>
test/com/sun/javadoc/testDocRootLink/pkg2/C2.java
浏览文件 @
bfc9f6c3
...
...
@@ -24,8 +24,13 @@
package
pkg2
;
/**
* Class 1. This is a test.
* Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a>. Lets see if this works
* or not.
* Class 2. This is a test.
* Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a> should be
* replaced with an absolute link.
* This <a href="{@docRoot}/pkg1/C1.html">Here</a> should not be replaced
* with an absolute link.
* Testing <a href="{@docRoot}/technotes/guides/index.html">Link 1</a> and
* <a href="{@docRoot}/pkg1/C1.html">Link 2</a>. Both should not be replaced with
* an absolute link.
*/
public
class
C2
{}
test/com/sun/javadoc/testDocRootLink/pkg2/package.html
浏览文件 @
bfc9f6c3
...
...
@@ -3,16 +3,16 @@
<title>
javax.management package
</title>
</head>
<body
bgcolor=
"white"
>
This is a test.
<p
id=
"spec"
>
@see
<a
href=
"{@docRoot}/../technotes/guides/index.html"
>
Test document 1
</a>
in particular the
<a
href=
"{@docRoot}/../technotes/guides/index.html"
>
This is a test.
<p
id=
"spec"
>
@see
<a
href=
"{@docRoot}/../technotes/guides/index.html"
>
Test document 1
</a>
should be replaced with an absolute link.
@see
<a
href=
"{@docRoot}/pkg1/C1.html"
>
Another Test document 1
</a>
which should not be replaced with an absolute link.
<a
href=
"{@docRoot}/technotes/guides/index.html"
>
Another Test document 2.
</a>
which should not be replaced with an absolute link.
Test document 2.
</a>
@since 1.5
@since 1.5
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录