Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
dc3d8854
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看板
提交
dc3d8854
编写于
2月 04, 2013
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8007490: NPE from DocumentationTool.run
Reviewed-by: darcy
上级
e0ea14d0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
51 addition
and
7 deletion
+51
-7
src/share/classes/com/sun/tools/javadoc/api/JavadocTool.java
src/share/classes/com/sun/tools/javadoc/api/JavadocTool.java
+3
-3
test/tools/javadoc/api/basic/RunTest.java
test/tools/javadoc/api/basic/RunTest.java
+48
-4
未找到文件。
src/share/classes/com/sun/tools/javadoc/api/JavadocTool.java
浏览文件 @
dc3d8854
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012,
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
...
...
@@ -139,8 +139,8 @@ public class JavadocTool implements DocumentationTool {
@Override
public
int
run
(
InputStream
in
,
OutputStream
out
,
OutputStream
err
,
String
...
arguments
)
{
PrintWriter
err_pw
=
new
PrintWriter
(
err
,
true
);
PrintWriter
out_pw
=
new
PrintWriter
(
out
);
PrintWriter
err_pw
=
new
PrintWriter
(
err
==
null
?
System
.
err
:
err
,
true
);
PrintWriter
out_pw
=
new
PrintWriter
(
out
==
null
?
System
.
out
:
out
);
try
{
String
standardDocletName
=
"com.sun.tools.doclets.standard.Standard"
;
return
com
.
sun
.
tools
.
javadoc
.
Main
.
execute
(
...
...
test/tools/javadoc/api/basic/RunTest.java
浏览文件 @
dc3d8854
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012,
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 6493690
* @bug 6493690
8007490
* @summary javadoc should have a javax.tools.Tool service provider
* @build APITest
* @run main RunTest
...
...
@@ -31,6 +31,7 @@
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.PrintStream
;
import
javax.tools.DocumentationTool
;
import
javax.tools.ToolProvider
;
...
...
@@ -46,7 +47,7 @@ public class RunTest extends APITest {
* Verify that run method can be invoked.
*/
@Test
public
void
testRun
()
throws
Exception
{
public
void
testRun
OK
()
throws
Exception
{
File
testSrc
=
new
File
(
System
.
getProperty
(
"test.src"
));
File
srcFile
=
new
File
(
testSrc
,
"pkg/C.java"
);
File
outDir
=
getOutDir
();
...
...
@@ -77,7 +78,7 @@ public class RunTest extends APITest {
* Verify that run method can be invoked.
*/
@Test
public
void
testRun
2
()
throws
Exception
{
public
void
testRun
Fail
()
throws
Exception
{
File
outDir
=
getOutDir
();
String
badfile
=
"badfile.java"
;
String
[]
args
=
{
"-d"
,
outDir
.
getPath
(),
badfile
};
...
...
@@ -100,5 +101,48 @@ public class RunTest extends APITest {
}
}
/**
* Verify that null args are accepted.
*/
@Test
public
void
testNullArgs
()
throws
Exception
{
File
testSrc
=
new
File
(
System
.
getProperty
(
"test.src"
));
File
srcFile
=
new
File
(
testSrc
,
"pkg/C.java"
);
File
outDir
=
getOutDir
();
String
[]
args
=
{
"-d"
,
outDir
.
getPath
(),
srcFile
.
getPath
()
};
ByteArrayOutputStream
stdout
=
new
ByteArrayOutputStream
();
PrintStream
prevStdout
=
System
.
out
;
System
.
setOut
(
new
PrintStream
(
stdout
));
ByteArrayOutputStream
stderr
=
new
ByteArrayOutputStream
();
PrintStream
prevStderr
=
System
.
err
;
System
.
setErr
(
new
PrintStream
(
stderr
));
int
rc
;
try
{
DocumentationTool
tool
=
ToolProvider
.
getSystemDocumentationTool
();
rc
=
tool
.
run
(
null
,
null
,
null
,
args
);
}
finally
{
System
.
setOut
(
prevStdout
);
System
.
setErr
(
prevStderr
);
}
System
.
err
.
println
(
"stdout >>"
+
stdout
.
toString
()
+
"<<"
);
System
.
err
.
println
(
"stderr >>"
+
stderr
.
toString
()
+
"<<"
);
if
(
rc
==
0
)
{
System
.
err
.
println
(
"call succeeded"
);
checkFiles
(
outDir
,
standardExpectFiles
);
String
out
=
stdout
.
toString
();
for
(
String
f:
standardExpectFiles
)
{
String
f1
=
f
.
replace
(
'/'
,
File
.
separatorChar
);
if
(
f1
.
endsWith
(
".html"
)
&&
!
out
.
contains
(
f1
))
error
(
"expected string not found: "
+
f1
);
}
}
else
{
error
(
"call failed"
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录