Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
9fa48065
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看板
提交
9fa48065
编写于
10月 26, 2012
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8001219: Clean up use of URLs in javadoc Extern class
Reviewed-by: darcy
上级
8311b51d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
50 deletion
+46
-50
src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
...com/sun/tools/doclets/internal/toolkit/Configuration.java
+2
-2
src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java
...s/com/sun/tools/doclets/internal/toolkit/util/Extern.java
+44
-48
未找到文件。
src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
浏览文件 @
9fa48065
...
...
@@ -408,11 +408,11 @@ public abstract class Configuration {
group
.
checkPackageGroups
(
os
[
1
],
os
[
2
]);
}
else
if
(
opt
.
equals
(
"-link"
))
{
String
url
=
os
[
1
];
extern
.
url
(
url
,
url
,
root
,
false
);
extern
.
link
(
url
,
url
,
root
,
false
);
}
else
if
(
opt
.
equals
(
"-linkoffline"
))
{
String
url
=
os
[
1
];
String
pkglisturl
=
os
[
2
];
extern
.
url
(
url
,
pkglisturl
,
root
,
true
);
extern
.
link
(
url
,
pkglisturl
,
root
,
true
);
}
}
if
(
sourcepath
.
length
()
==
0
)
{
...
...
src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java
浏览文件 @
9fa48065
...
...
@@ -167,17 +167,38 @@ public class Extern {
* @param pkglisturl This can be another URL for "package-list" or ordinary
* file.
* @param reporter The <code>DocErrorReporter</code> used to report errors.
* @param linkoffline True if -linkoffline isused and false if -link is used.
* @param linkoffline True if -linkoffline is
used and false if -link is used.
*/
public
boolean
url
(
String
url
,
String
pkglisturl
,
public
boolean
link
(
String
url
,
String
pkglisturl
,
DocErrorReporter
reporter
,
boolean
linkoffline
)
{
this
.
linkoffline
=
linkoffline
;
String
errMsg
=
composeExternPackageList
(
url
,
pkglisturl
);
if
(
errMsg
!=
null
)
{
reporter
.
printWarning
(
errMsg
);
return
false
;
}
else
{
try
{
url
=
adjustEndFileSeparator
(
url
);
if
(
isUrl
(
pkglisturl
))
{
readPackageListFromURL
(
url
,
toURL
(
pkglisturl
));
}
else
{
readPackageListFromFile
(
url
,
new
File
(
pkglisturl
));
}
return
true
;
}
catch
(
Fault
f
)
{
reporter
.
printWarning
(
f
.
getMessage
());
return
false
;
}
}
private
URL
toURL
(
String
url
)
throws
Fault
{
try
{
return
new
URL
(
url
);
}
catch
(
MalformedURLException
e
)
{
throw
new
Fault
(
configuration
.
getText
(
"doclet.MalformedURL"
,
url
),
e
);
}
}
private
class
Fault
extends
Exception
{
private
static
final
long
serialVersionUID
=
0
;
Fault
(
String
msg
,
Exception
cause
)
{
super
(
msg
,
cause
);
}
}
...
...
@@ -193,32 +214,11 @@ public class Extern {
return
packageToItemMap
.
get
(
pkgName
);
}
/**
* Adjusts the end file separator if it is missing from the URL or the
* directory path and depending upon the URL or file path, fetch or
* read the "package-list" file.
*
* @param urlOrDirPath URL or the directory path.
* @param pkgListUrlOrDirPath URL or directory path for the "package-list" file or the "package-list"
* file itself.
*/
private
String
composeExternPackageList
(
String
urlOrDirPath
,
String
pkgListUrlOrDirPath
)
{
urlOrDirPath
=
adjustEndFileSeparator
(
urlOrDirPath
);
pkgListUrlOrDirPath
=
adjustEndFileSeparator
(
pkgListUrlOrDirPath
);
return
isUrl
(
pkgListUrlOrDirPath
)
?
fetchURLComposeExternPackageList
(
urlOrDirPath
,
pkgListUrlOrDirPath
)
:
readFileComposeExternPackageList
(
urlOrDirPath
,
pkgListUrlOrDirPath
);
}
/**
* If the URL or Directory path is missing end file separator, add that.
*/
private
String
adjustEndFileSeparator
(
String
url
)
{
String
filesep
=
"/"
;
if
(!
url
.
endsWith
(
filesep
))
{
url
+=
filesep
;
}
return
url
;
return
url
.
endsWith
(
"/"
)
?
url
:
url
+
'/'
;
}
/**
...
...
@@ -227,17 +227,18 @@ public class Extern {
* @param urlpath Path to the packages.
* @param pkglisturlpath URL or the path to the "package-list" file.
*/
private
String
fetchURLComposeExternPackageList
(
String
urlpath
,
String
pkglisturlpath
)
{
String
link
=
pkglisturlpath
+
"package-list"
;
private
void
readPackageListFromURL
(
String
urlpath
,
URL
pkglisturlpath
)
throws
Fault
{
try
{
readPackageList
((
new
URL
(
link
)).
openStream
(),
urlpath
,
false
);
URL
link
=
pkglisturlpath
.
toURI
().
resolve
(
DocPaths
.
PACKAGE_LIST
.
getPath
()).
toURL
();
readPackageList
(
link
.
openStream
(),
urlpath
,
false
);
}
catch
(
URISyntaxException
exc
)
{
throw
new
Fault
(
configuration
.
getText
(
"doclet.MalformedURL"
,
pkglisturlpath
.
toString
()),
exc
);
}
catch
(
MalformedURLException
exc
)
{
return
configuration
.
getText
(
"doclet.MalformedURL"
,
link
);
throw
new
Fault
(
configuration
.
getText
(
"doclet.MalformedURL"
,
pkglisturlpath
.
toString
()),
exc
);
}
catch
(
IOException
exc
)
{
return
configuration
.
getText
(
"doclet.URL_error"
,
link
);
throw
new
Fault
(
configuration
.
getText
(
"doclet.URL_error"
,
pkglisturlpath
.
toString
()),
exc
);
}
return
null
;
}
/**
...
...
@@ -246,27 +247,22 @@ public class Extern {
* @param path URL or directory path to the packages.
* @param pkgListPath Path to the local "package-list" file.
*/
private
String
readFileComposeExternPackageList
(
String
path
,
String
pkgListPath
)
{
String
link
=
pkgListPath
+
"package-list"
;
if
(!
((
new
File
(
pkgListPath
)).
isAbsolute
()
||
linkoffline
)){
link
=
configuration
.
destDirName
+
link
;
private
void
readPackageListFromFile
(
String
path
,
File
pkgListPath
)
throws
Fault
{
File
file
=
new
File
(
pkgListPath
,
"package-list"
);
if
(!
(
file
.
isAbsolute
()
||
linkoffline
)){
file
=
new
File
(
configuration
.
destDirName
,
file
.
getPath
());
}
try
{
File
file
=
new
File
(
link
);
if
(
file
.
exists
()
&&
file
.
canRead
())
{
readPackageList
(
new
FileInputStream
(
file
),
path
,
!
((
new
File
(
path
)).
isAbsolute
()
||
isUrl
(
path
)));
}
else
{
return
configuration
.
getText
(
"doclet.File_error"
,
link
);
throw
new
Fault
(
configuration
.
getText
(
"doclet.File_error"
,
file
.
getPath
()),
null
);
}
}
catch
(
FileNotFoundException
exc
)
{
return
configuration
.
getText
(
"doclet.File_error"
,
link
);
}
catch
(
IOException
exc
)
{
return
configuration
.
getText
(
"doclet.File_error"
,
link
);
throw
new
Fault
(
configuration
.
getText
(
"doclet.File_error"
,
file
.
getPath
()),
exc
);
}
return
null
;
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录