Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
63a9023f
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看板
提交
63a9023f
编写于
3月 04, 2011
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6227454: package.html and overview.html may not be read fully
Reviewed-by: bpatel
上级
d485c90d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
164 addition
and
42 deletion
+164
-42
src/share/classes/com/sun/tools/javadoc/DocImpl.java
src/share/classes/com/sun/tools/javadoc/DocImpl.java
+21
-40
src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties
...lasses/com/sun/tools/javadoc/resources/javadoc.properties
+2
-2
test/tools/javadoc/6227454/Test.java
test/tools/javadoc/6227454/Test.java
+141
-0
未找到文件。
src/share/classes/com/sun/tools/javadoc/DocImpl.java
浏览文件 @
63a9023f
/*
/*
* Copyright (c) 1997, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
11
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
package
com.sun.tools.javadoc
;
package
com.sun.tools.javadoc
;
import
java.io.DataInputStream
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.text.CollationKey
;
import
java.text.CollationKey
;
...
@@ -33,6 +34,8 @@ import javax.tools.FileObject;
...
@@ -33,6 +34,8 @@ import javax.tools.FileObject;
import
com.sun.javadoc.*
;
import
com.sun.javadoc.*
;
import
com.sun.tools.javac.util.Position
;
import
com.sun.tools.javac.util.Position
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
/**
* abstract base class of all Doc classes. Doc item's are representations
* abstract base class of all Doc classes. Doc item's are representations
...
@@ -166,51 +169,28 @@ public abstract class DocImpl implements Doc, Comparable<Object> {
...
@@ -166,51 +169,28 @@ public abstract class DocImpl implements Doc, Comparable<Object> {
* Utility for subclasses which read HTML documentation files.
* Utility for subclasses which read HTML documentation files.
*/
*/
String
readHTMLDocumentation
(
InputStream
input
,
FileObject
filename
)
throws
IOException
{
String
readHTMLDocumentation
(
InputStream
input
,
FileObject
filename
)
throws
IOException
{
int
filesize
=
input
.
available
();
byte
[]
filecontents
=
new
byte
[
input
.
available
()];
byte
[]
filecontents
=
new
byte
[
filesize
];
try
{
input
.
read
(
filecontents
,
0
,
filesize
);
DataInputStream
dataIn
=
new
DataInputStream
(
input
);
input
.
close
();
dataIn
.
readFully
(
filecontents
);
}
finally
{
input
.
close
();
}
String
encoding
=
env
.
getEncoding
();
String
encoding
=
env
.
getEncoding
();
String
rawDoc
=
(
encoding
!=
null
)
String
rawDoc
=
(
encoding
!=
null
)
?
new
String
(
filecontents
,
encoding
)
?
new
String
(
filecontents
,
encoding
)
:
new
String
(
filecontents
);
:
new
String
(
filecontents
);
String
upper
=
null
;
Pattern
bodyPat
=
Pattern
.
compile
(
"(?is).*<body\\b[^>]*>(.*)</body\\b.*"
);
int
bodyIdx
=
rawDoc
.
indexOf
(
"<body"
);
Matcher
m
=
bodyPat
.
matcher
(
rawDoc
);
if
(
bodyIdx
==
-
1
)
{
if
(
m
.
matches
())
{
bodyIdx
=
rawDoc
.
indexOf
(
"<BODY"
);
return
m
.
group
(
1
);
if
(
bodyIdx
==
-
1
)
{
}
else
{
upper
=
rawDoc
.
toUpperCase
();
String
key
=
rawDoc
.
matches
(
"(?is).*<body\\b.*"
)
bodyIdx
=
upper
.
indexOf
(
"<BODY"
);
?
"javadoc.End_body_missing_from_html_file"
if
(
bodyIdx
==
-
1
)
{
:
"javadoc.Body_missing_from_html_file"
;
env
.
error
(
SourcePositionImpl
.
make
(
filename
,
Position
.
NOPOS
,
null
),
env
.
error
(
SourcePositionImpl
.
make
(
filename
,
Position
.
NOPOS
,
null
),
key
);
"javadoc.Body_missing_from_html_file"
);
return
""
;
}
}
}
bodyIdx
=
rawDoc
.
indexOf
(
'>'
,
bodyIdx
);
if
(
bodyIdx
==
-
1
)
{
env
.
error
(
SourcePositionImpl
.
make
(
filename
,
Position
.
NOPOS
,
null
),
"javadoc.Body_missing_from_html_file"
);
return
""
;
return
""
;
}
}
++
bodyIdx
;
int
endIdx
=
rawDoc
.
indexOf
(
"</body"
,
bodyIdx
);
if
(
endIdx
==
-
1
)
{
endIdx
=
rawDoc
.
indexOf
(
"</BODY"
,
bodyIdx
);
if
(
endIdx
==
-
1
)
{
if
(
upper
==
null
)
{
upper
=
rawDoc
.
toUpperCase
();
}
endIdx
=
upper
.
indexOf
(
"</BODY"
,
bodyIdx
);
if
(
endIdx
==
-
1
)
{
env
.
error
(
SourcePositionImpl
.
make
(
filename
,
Position
.
NOPOS
,
null
),
"javadoc.End_body_missing_from_html_file"
);
return
""
;
}
}
}
return
rawDoc
.
substring
(
bodyIdx
,
endIdx
);
}
}
/**
/**
...
@@ -256,6 +236,7 @@ public abstract class DocImpl implements Doc, Comparable<Object> {
...
@@ -256,6 +236,7 @@ public abstract class DocImpl implements Doc, Comparable<Object> {
/**
/**
* Returns a string representation of this Doc item.
* Returns a string representation of this Doc item.
*/
*/
@Override
public
String
toString
()
{
public
String
toString
()
{
return
qualifiedName
();
return
qualifiedName
();
}
}
...
...
src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties
浏览文件 @
63a9023f
#
#
# Copyright (c) 1997, 201
0
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 201
1
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
#
# This code is free software; you can redistribute it and/or modify it
# This code is free software; you can redistribute it and/or modify it
...
@@ -104,7 +104,7 @@ tag.throws.exception_not_found={0} tag, class {1} not found.
...
@@ -104,7 +104,7 @@ tag.throws.exception_not_found={0} tag, class {1} not found.
tag.End_delimiter_missing_for_possible_SeeTag
=
End Delimiter } missing for possible See Tag in comment string: "{0}"
tag.End_delimiter_missing_for_possible_SeeTag
=
End Delimiter } missing for possible See Tag in comment string: "{0}"
tag.Improper_Use_Of_Link_Tag
=
Missing closing ''}'' character for inline tag: "{0}"
tag.Improper_Use_Of_Link_Tag
=
Missing closing ''}'' character for inline tag: "{0}"
javadoc.File_Read_Error
=
Error while reading file {0}
javadoc.File_Read_Error
=
Error while reading file {0}
javadoc.Body_missing_from_html_file
=
Body tag missing from HTML
javadoc.Body_missing_from_html_file
=
Body tag missing from HTML
file
javadoc.End_body_missing_from_html_file
=
Close body tag missing from HTML file
javadoc.End_body_missing_from_html_file
=
Close body tag missing from HTML file
javadoc.Multiple_package_comments
=
Multiple sources of package comments found for package "{0}"
javadoc.Multiple_package_comments
=
Multiple sources of package comments found for package "{0}"
javadoc.class_not_found
=
Class {0} not found.
javadoc.class_not_found
=
Class {0} not found.
...
...
test/tools/javadoc/6227454/Test.java
0 → 100644
浏览文件 @
63a9023f
/*
* Copyright (c) 2011, 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 6227454
* @summary package.html and overview.html may not be read fully
*/
import
java.io.*
;
import
com.sun.javadoc.Doclet
;
import
com.sun.javadoc.RootDoc
;
public
class
Test
extends
Doclet
{
public
static
void
main
(
String
...
args
)
throws
Exception
{
new
Test
().
run
();
}
void
run
()
throws
Exception
{
test
(
"<html><body>ABC XYZ</body></html>"
);
test
(
"<html><body>ABC XYZ</BODY></html>"
);
test
(
"<html><BODY>ABC XYZ</body></html>"
);
test
(
"<html><BODY>ABC XYZ</BODY></html>"
);
test
(
"<html><BoDy>ABC XYZ</bOdY></html>"
);
test
(
"<html> ABC XYZ</bOdY></html>"
,
"Body tag missing from HTML"
);
test
(
"<html><body>ABC XYZ </html>"
,
"Close body tag missing from HTML"
);
test
(
"<html> ABC XYZ </html>"
,
"Body tag missing from HTML"
);
test
(
"<html><body>ABC"
+
bigText
(
8192
,
40
)
+
"XYZ</body></html>"
);
if
(
errors
>
0
)
throw
new
Exception
(
errors
+
" errors occurred"
);
}
void
test
(
String
text
)
throws
IOException
{
test
(
text
,
null
);
}
void
test
(
String
text
,
String
expectError
)
throws
IOException
{
testNum
++;
System
.
err
.
println
(
"test "
+
testNum
);
File
file
=
writeFile
(
"overview"
+
testNum
+
".html"
,
text
);
String
thisClassName
=
Test
.
class
.
getName
();
File
testSrc
=
new
File
(
System
.
getProperty
(
"test.src"
));
String
[]
args
=
{
"-bootclasspath"
,
System
.
getProperty
(
"java.class.path"
)
+
File
.
pathSeparator
+
System
.
getProperty
(
"sun.boot.class.path"
),
"-classpath"
,
"."
,
"-package"
,
"-overview"
,
file
.
getPath
(),
new
File
(
testSrc
,
thisClassName
+
".java"
).
getPath
()
};
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
int
rc
=
com
.
sun
.
tools
.
javadoc
.
Main
.
execute
(
"javadoc"
,
pw
,
pw
,
pw
,
thisClassName
,
args
);
pw
.
close
();
String
out
=
sw
.
toString
();
if
(!
out
.
isEmpty
())
System
.
err
.
println
(
out
);
System
.
err
.
println
(
"javadoc exit: rc="
+
rc
);
if
(
expectError
==
null
)
{
if
(
rc
!=
0
)
error
(
"unexpected exit from javadoc; rc:"
+
rc
);
}
else
{
if
(!
out
.
contains
(
expectError
))
error
(
"expected error text not found: "
+
expectError
);
}
}
String
bigText
(
int
lines
,
int
lineLength
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
lineLength
;
i
++)
sb
.
append
(
String
.
valueOf
(
i
%
10
));
sb
.
append
(
"\n"
);
String
line
=
sb
.
toString
();
sb
.
setLength
(
0
);
for
(
int
i
=
0
;
i
<
lines
;
i
++)
sb
.
append
(
line
);
return
sb
.
toString
();
}
File
writeFile
(
String
path
,
String
body
)
throws
IOException
{
File
f
=
new
File
(
path
);
FileWriter
out
=
new
FileWriter
(
f
);
try
{
out
.
write
(
body
);
}
finally
{
out
.
close
();
}
return
f
;
}
void
error
(
String
msg
)
{
System
.
err
.
println
(
"Error: "
+
msg
);
errors
++;
}
int
testNum
;
int
errors
;
public
static
boolean
start
(
RootDoc
root
)
{
String
text
=
root
.
commentText
();
if
(
text
.
length
()
<
64
)
System
.
err
.
println
(
"text: '"
+
text
+
"'"
);
else
System
.
err
.
println
(
"text: '"
+
text
.
substring
(
0
,
20
)
+
"..."
+
text
.
substring
(
text
.
length
()
-
20
)
+
"'"
);
return
text
.
startsWith
(
"ABC"
)
&&
text
.
endsWith
(
"XYZ"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录