Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
59003066
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
59003066
编写于
4月 12, 2012
作者:
S
sherman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7067045: replaceAll("\u20ac", "$"); causses java.lang.StringIndexOutOfBoundsExceptio
Summary: Updated to throw IAE instead. Reviewed-by: lancea
上级
62ef905d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
4 deletion
+19
-4
src/share/classes/java/util/regex/Matcher.java
src/share/classes/java/util/regex/Matcher.java
+7
-4
test/java/util/regex/RegExTest.java
test/java/util/regex/RegExTest.java
+12
-0
未找到文件。
src/share/classes/java/util/regex/Matcher.java
浏览文件 @
59003066
...
...
@@ -759,16 +759,19 @@ public final class Matcher implements MatchResult {
char
nextChar
=
replacement
.
charAt
(
cursor
);
if
(
nextChar
==
'\\'
)
{
cursor
++;
if
(
cursor
==
replacement
.
length
())
throw
new
IllegalArgumentException
(
"character to be escaped is missing"
);
nextChar
=
replacement
.
charAt
(
cursor
);
result
.
append
(
nextChar
);
cursor
++;
}
else
if
(
nextChar
==
'$'
)
{
// Skip past $
cursor
++;
//
A StringIndexOutOfBoundsException is thrown if
// this "$" is the last character in replacement
// string in current implementation, a IAE might be
// more appropriate.
//
Throw IAE if this "$" is the last character in replacement
if
(
cursor
==
replacement
.
length
())
throw
new
IllegalArgumentException
(
"Illegal group reference: group index is missing"
);
nextChar
=
replacement
.
charAt
(
cursor
);
int
refNum
=
-
1
;
if
(
nextChar
==
'{'
)
{
...
...
test/java/util/regex/RegExTest.java
浏览文件 @
59003066
...
...
@@ -33,6 +33,7 @@
* 5013885 5003322 4988891 5098443 5110268 6173522 4829857 5027748 6376940
* 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
* 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
* 7067045
*/
import
java.util.regex.*
;
...
...
@@ -852,6 +853,17 @@ public class RegExTest {
if
(!
result
.
equals
(
toSupplementaries
(
"zzz\\t$\\$zzz"
)))
failCount
++;
// IAE should be thrown if backslash or '$' is the last character
// in replacement string
try
{
"\uac00"
.
replaceAll
(
"\uac00"
,
"$"
);
"\uac00"
.
replaceAll
(
"\uac00"
,
"\\"
);
failCount
++;
}
catch
(
IllegalArgumentException
iie
)
{
}
catch
(
Exception
e
)
{
failCount
++;
}
report
(
"Literal replacement"
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录