Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
6ad85204
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看板
提交
6ad85204
编写于
1月 15, 2013
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8006224: Doclint NPE for attribute with no value
Reviewed-by: darcy
上级
e4892d55
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
143 addition
and
8 deletion
+143
-8
src/share/classes/com/sun/tools/doclint/Checker.java
src/share/classes/com/sun/tools/doclint/Checker.java
+11
-7
src/share/classes/com/sun/tools/doclint/resources/doclint.properties
...lasses/com/sun/tools/doclint/resources/doclint.properties
+2
-1
test/tools/doclint/AnchorTest.java
test/tools/doclint/AnchorTest.java
+93
-0
test/tools/doclint/AnchorTest.out
test/tools/doclint/AnchorTest.out
+37
-0
未找到文件。
src/share/classes/com/sun/tools/doclint/Checker.java
浏览文件 @
6ad85204
/*
* 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
...
...
@@ -447,14 +447,18 @@ public class Checker extends DocTreeScanner<Void, Void> {
if
(
currTag
!=
HtmlTag
.
A
)
{
break
;
}
// fallthrough
// fallthrough
case
ID:
String
value
=
getAttrValue
(
tree
);
if
(!
validName
.
matcher
(
value
).
matches
())
{
env
.
messages
.
error
(
HTML
,
tree
,
"dc.invalid.anchor"
,
value
);
}
if
(!
foundAnchors
.
add
(
value
))
{
env
.
messages
.
error
(
HTML
,
tree
,
"dc.anchor.already.defined"
,
value
);
if
(
value
==
null
)
{
env
.
messages
.
error
(
HTML
,
tree
,
"dc.anchor.value.missing"
);
}
else
{
if
(!
validName
.
matcher
(
value
).
matches
())
{
env
.
messages
.
error
(
HTML
,
tree
,
"dc.invalid.anchor"
,
value
);
}
if
(!
foundAnchors
.
add
(
value
))
{
env
.
messages
.
error
(
HTML
,
tree
,
"dc.anchor.already.defined"
,
value
);
}
}
break
;
...
...
src/share/classes/com/sun/tools/doclint/resources/doclint.properties
浏览文件 @
6ad85204
#
# 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
...
...
@@ -24,6 +24,7 @@
#
dc.anchor.already.defined
=
anchor already defined: {0}
dc.anchor.value.missing
=
no value given for anchor
dc.attr.lacks.value
=
attribute lacks value
dc.attr.obsolete
=
attribute obsolete: {0}
dc.attr.obsolete.use.css
=
attribute obsolete, use CSS instead: {0}
...
...
test/tools/doclint/AnchorTest.java
0 → 100644
浏览文件 @
6ad85204
/*
* @test /nodynamiccopyright/
* @bug 8004832
* @summary Add new doclint package
* @build DocLintTester
* @run main DocLintTester -ref AnchorTest.out AnchorTest.java
*/
/** */
public
class
AnchorTest
{
// tests for <a name=value>
/**
* <a name=foo></a>
*/
public
void
a_name_foo
()
{
}
/**
* <a name=foo></a>
*/
public
void
a_name_already_defined
()
{
}
/**
* <a name=></a>
*/
public
void
a_name_empty
()
{
}
/**
* <a name=123 ></a>
*/
public
void
a_name_invalid
()
{
}
/**
* <a name ></a>
*/
public
void
a_name_missing
()
{
}
// tests for <a id=value>
/**
* <a id=a_id_foo></a>
*/
public
void
a_id_foo
()
{
}
/**
* <a id=foo></a>
*/
public
void
a_id_already_defined
()
{
}
/**
* <a id=></a>
*/
public
void
a_id_empty
()
{
}
/**
* <a id=123 ></a>
*/
public
void
a_id_invalid
()
{
}
/**
* <a id ></a>
*/
public
void
a_id_missing
()
{
}
// tests for id=value on non-<a> tags
/**
* <p id=p_id_foo>text</p>
*/
public
void
p_id_foo
()
{
}
/**
* <p id=foo>text</p>
*/
public
void
p_id_already_defined
()
{
}
/**
* <p id=>text</p>
*/
public
void
p_id_empty
()
{
}
/**
* <p id=123 >text</p>
*/
public
void
p_id_invalid
()
{
}
/**
* <p id >text</p>
*/
public
void
p_id_missing
()
{
}
}
test/tools/doclint/AnchorTest.out
0 → 100644
浏览文件 @
6ad85204
AnchorTest.java:19: error: anchor already defined: foo
* <a name=foo></a>
^
AnchorTest.java:24: error: invalid name for anchor: ""
* <a name=></a>
^
AnchorTest.java:29: error: invalid name for anchor: "123"
* <a name=123 ></a>
^
AnchorTest.java:34: error: no value given for anchor
* <a name ></a>
^
AnchorTest.java:46: error: anchor already defined: foo
* <a id=foo></a>
^
AnchorTest.java:51: error: invalid name for anchor: ""
* <a id=></a>
^
AnchorTest.java:56: error: invalid name for anchor: "123"
* <a id=123 ></a>
^
AnchorTest.java:61: error: no value given for anchor
* <a id ></a>
^
AnchorTest.java:73: error: anchor already defined: foo
* <p id=foo>text</p>
^
AnchorTest.java:78: error: invalid name for anchor: ""
* <p id=>text</p>
^
AnchorTest.java:83: error: invalid name for anchor: "123"
* <p id=123 >text</p>
^
AnchorTest.java:88: error: no value given for anchor
* <p id >text</p>
^
12 errors
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录