提交 14fc7af7 编写于 作者: I igerasim

8184706: Matcher doesn't indicate hitEnd after matching \u0D with \R at EOL

Reviewed-by: sherman
上级 6f9d139a
......@@ -3887,9 +3887,13 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
return next.match(matcher, i + 1, seq);
if (ch == 0x0D) {
i++;
if (i < matcher.to && seq.charAt(i) == 0x0A &&
next.match(matcher, i + 1, seq)) {
return true;
if (i < matcher.to) {
if (seq.charAt(i) == 0x0A &&
next.match(matcher, i + 1, seq)) {
return true;
}
} else {
matcher.hitEnd = true;
}
return next.match(matcher, i, seq);
}
......
......@@ -33,9 +33,8 @@
* 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
* 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590
* 8027645 8035076 8039124 8035975 8074678 6854417 8143854 8147531 7071819
* 8151481 4867170 7080302 6728861 6995635 6736245 4916384
* 6328855 6192895 6345469 6988218 6693451 7006761 8140212 8143282 8158482
* 8176029
* 8151481 4867170 7080302 6728861 6995635 6736245 4916384 6328855 6192895
* 6345469 6988218 6693451 7006761 8140212 8143282 8158482 8176029 8184706
*
* @library /test/lib
* @build jdk.test.lib.RandomFactory
......@@ -470,7 +469,25 @@ public class RegExTest {
m.find();
if (!m.hitEnd())
failCount++;
report("hitEnd from a Slice");
// 8184706: Matching u+0d at EOL against \R should hit-end
p = Pattern.compile("...\\R");
m = p.matcher("cat" + (char)0x0a);
m.find();
if (m.hitEnd())
failCount++;
m = p.matcher("cat" + (char)0x0d);
m.find();
if (!m.hitEnd())
failCount++;
m = p.matcher("cat" + (char)0x0d + (char)0x0a);
m.find();
if (m.hitEnd())
failCount++;
report("hitEnd");
}
// This is for bug 4997476
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册