Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d382e1ae
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看板
提交
d382e1ae
编写于
11月 13, 2013
作者:
S
sherman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8028321: Fix for String.split() empty input sequence/JDK-6559590 triggers regression
Summary: to undo the change for 6559590 Reviewed-by: darcy
上级
82b7b483
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
19 addition
and
19 deletion
+19
-19
src/share/classes/java/lang/String.java
src/share/classes/java/lang/String.java
+1
-4
src/share/classes/java/util/regex/Pattern.java
src/share/classes/java/util/regex/Pattern.java
+2
-7
test/java/lang/String/Split.java
test/java/lang/String/Split.java
+3
-1
test/java/util/regex/RegExTest.java
test/java/util/regex/RegExTest.java
+13
-7
未找到文件。
src/share/classes/java/lang/String.java
浏览文件 @
d382e1ae
...
@@ -2235,8 +2235,7 @@ public final class String
...
@@ -2235,8 +2235,7 @@ public final class String
* expression or is terminated by the end of the string. The substrings in
* expression or is terminated by the end of the string. The substrings in
* the array are in the order in which they occur in this string. If the
* the array are in the order in which they occur in this string. If the
* expression does not match any part of the input then the resulting array
* expression does not match any part of the input then the resulting array
* has just one element, namely this string. A zero-length input sequence
* has just one element, namely this string.
* always results zero-length resulting array.
*
*
* <p> When there is a positive-width match at the beginning of this
* <p> When there is a positive-width match at the beginning of this
* string then an empty leading substring is included at the beginning
* string then an empty leading substring is included at the beginning
...
@@ -2331,8 +2330,6 @@ public final class String
...
@@ -2331,8 +2330,6 @@ public final class String
(
ch
<
Character
.
MIN_HIGH_SURROGATE
||
(
ch
<
Character
.
MIN_HIGH_SURROGATE
||
ch
>
Character
.
MAX_LOW_SURROGATE
))
ch
>
Character
.
MAX_LOW_SURROGATE
))
{
{
if
(
value
.
length
==
0
)
return
new
String
[
0
];
int
off
=
0
;
int
off
=
0
;
int
next
=
0
;
int
next
=
0
;
boolean
limited
=
limit
>
0
;
boolean
limited
=
limit
>
0
;
...
...
src/share/classes/java/util/regex/Pattern.java
浏览文件 @
d382e1ae
...
@@ -1144,8 +1144,7 @@ public final class Pattern
...
@@ -1144,8 +1144,7 @@ public final class Pattern
* substrings in the array are in the order in which they occur in the
* substrings in the array are in the order in which they occur in the
* input. If this pattern does not match any subsequence of the input then
* input. If this pattern does not match any subsequence of the input then
* the resulting array has just one element, namely the input sequence in
* the resulting array has just one element, namely the input sequence in
* string form. A zero-length input sequence always results zero-length
* string form.
* resulting array.
*
*
* <p> When there is a positive-width match at the beginning of the input
* <p> When there is a positive-width match at the beginning of the input
* sequence then an empty leading substring is included at the beginning
* sequence then an empty leading substring is included at the beginning
...
@@ -1201,8 +1200,6 @@ public final class Pattern
...
@@ -1201,8 +1200,6 @@ public final class Pattern
* around matches of this pattern
* around matches of this pattern
*/
*/
public
String
[]
split
(
CharSequence
input
,
int
limit
)
{
public
String
[]
split
(
CharSequence
input
,
int
limit
)
{
if
(
input
.
length
()
==
0
)
return
new
String
[
0
];
int
index
=
0
;
int
index
=
0
;
boolean
matchLimited
=
limit
>
0
;
boolean
matchLimited
=
limit
>
0
;
ArrayList
<
String
>
matchList
=
new
ArrayList
<>();
ArrayList
<
String
>
matchList
=
new
ArrayList
<>();
...
@@ -5774,8 +5771,6 @@ NEXT: while (i <= last) {
...
@@ -5774,8 +5771,6 @@ NEXT: while (i <= last) {
* the resulting stream has just one element, namely the input sequence in
* the resulting stream has just one element, namely the input sequence in
* string form.
* string form.
*
*
* <p> A zero-length input sequence always results an empty stream.
*
* <p> When there is a positive-width match at the beginning of the input
* <p> When there is a positive-width match at the beginning of the input
* sequence then an empty leading substring is included at the beginning
* sequence then an empty leading substring is included at the beginning
* of the stream. A zero-width match at the beginning however never produces
* of the stream. A zero-width match at the beginning however never produces
...
...
test/java/lang/String/Split.java
浏览文件 @
d382e1ae
...
@@ -81,8 +81,10 @@ public class Split {
...
@@ -81,8 +81,10 @@ public class Split {
// split() now returns 0-length for empty source "" see #6559590
// split() now returns 0-length for empty source "" see #6559590
source
=
""
;
source
=
""
;
String
[]
result
=
source
.
split
(
"e"
,
0
);
String
[]
result
=
source
.
split
(
"e"
,
0
);
if
(
result
.
length
!=
0
)
if
(
result
.
length
!=
1
)
throw
new
RuntimeException
(
"String.split failure 8"
);
throw
new
RuntimeException
(
"String.split failure 8"
);
if
(!
result
[
0
].
equals
(
source
))
throw
new
RuntimeException
(
"String.split failure 9"
);
// check fastpath of String.split()
// check fastpath of String.split()
source
=
"0123456789abcdefgABCDEFG"
;
source
=
"0123456789abcdefgABCDEFG"
;
...
...
test/java/util/regex/RegExTest.java
浏览文件 @
d382e1ae
...
@@ -1781,7 +1781,9 @@ public class RegExTest {
...
@@ -1781,7 +1781,9 @@ public class RegExTest {
// split() now returns 0-length for empty source "" see #6559590
// split() now returns 0-length for empty source "" see #6559590
source
=
""
;
source
=
""
;
result
=
source
.
split
(
"e"
,
0
);
result
=
source
.
split
(
"e"
,
0
);
if
(
result
.
length
!=
0
)
if
(
result
.
length
!=
1
)
failCount
++;
if
(!
result
[
0
].
equals
(
source
))
failCount
++;
failCount
++;
// Check both split() and splitAsStraem(), especially for zero-lenth
// Check both split() and splitAsStraem(), especially for zero-lenth
...
@@ -1817,8 +1819,8 @@ public class RegExTest {
...
@@ -1817,8 +1819,8 @@ public class RegExTest {
{
"Abc"
,
"Efg"
,
"Hij"
},
{
"Abc"
,
"Efg"
,
"Hij"
},
{
"Abc"
,
"Efg"
},
{
"Abc"
,
"Efg"
},
{
"Abc"
},
{
"Abc"
},
{},
{
""
},
{},
{
""
},
{
"awgqwefg1fefw"
,
"vssv1vvv1"
},
{
"awgqwefg1fefw"
,
"vssv1vvv1"
},
{
"afbfq"
,
"bgwgb"
,
"wngnwggw"
,
""
,
"hjrnhneerh"
},
{
"afbfq"
,
"bgwgb"
,
"wngnwggw"
,
""
,
"hjrnhneerh"
},
...
@@ -1826,7 +1828,7 @@ public class RegExTest {
...
@@ -1826,7 +1828,7 @@ public class RegExTest {
{
"a\u4ebafg"
,
"fefw\u4eba4\u9f9cvssv\u9f9c"
,
"v\u672c\u672cvv"
},
{
"a\u4ebafg"
,
"fefw\u4eba4\u9f9cvssv\u9f9c"
,
"v\u672c\u672cvv"
},
{
"1"
,
"23"
,
"456"
,
"7890"
},
{
"1"
,
"23"
,
"456"
,
"7890"
},
{
"1"
,
"23\u9f9c\u672c\u672c"
,
"456"
,
"\u9f9c\u672c7890"
},
{
"1"
,
"23\u9f9c\u672c\u672c"
,
"456"
,
"\u9f9c\u672c7890"
},
{},
{
""
},
{
"This"
,
"is"
,
"testing"
,
""
,
"with"
,
"different"
,
"separators"
},
{
"This"
,
"is"
,
"testing"
,
""
,
"with"
,
"different"
,
"separators"
},
{
"b"
,
""
,
":and:f"
},
{
"b"
,
""
,
":and:f"
},
{
"b"
,
""
,
""
,
""
,
""
,
":and:f"
},
{
"b"
,
""
,
""
,
""
,
""
,
":and:f"
},
...
@@ -1834,12 +1836,16 @@ public class RegExTest {
...
@@ -1834,12 +1836,16 @@ public class RegExTest {
};
};
for
(
int
i
=
0
;
i
<
input
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
input
.
length
;
i
++)
{
pattern
=
Pattern
.
compile
(
input
[
i
][
0
]);
pattern
=
Pattern
.
compile
(
input
[
i
][
0
]);
if
(!
Arrays
.
equals
(
pattern
.
split
(
input
[
i
][
1
]),
expected
[
i
]))
if
(!
Arrays
.
equals
(
pattern
.
split
(
input
[
i
][
1
]),
expected
[
i
]))
{
failCount
++;
failCount
++;
if
(!
Arrays
.
equals
(
pattern
.
splitAsStream
(
input
[
i
][
1
]).
toArray
(),
}
expected
[
i
]))
if
(
input
[
i
][
1
].
length
()
>
0
&&
// splitAsStream() return empty resulting
// array for zero-length input for now
!
Arrays
.
equals
(
pattern
.
splitAsStream
(
input
[
i
][
1
]).
toArray
(),
expected
[
i
]))
{
failCount
++;
failCount
++;
}
}
}
report
(
"Split"
);
report
(
"Split"
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录