RFR JDK-8176029: Linebreak matcher is not equivalent to the pattern as stated in javadoc

Xueming Shen xueming.shen at oracle.com
Fri Mar 3 02:59:01 UTC 2017


On 3/2/17, 6:56 PM, Xueming Shen wrote:
> Hi,
>
> Please help review the change for JDK-8176029
>
> issue: https://bugs.openjdk.java.net/browse/JDK-8176029
> webrev: http://cr.openjdk.java.net/~sherman/8176029/webrev
>
> It appears the API doc for \R is correct, instead the implementation 
> is buggy when
> dealing with sequence "\r\n" (u+000du+000a). The existing 
> implementation fails to
> backtrack to match \r and then next.match() when the attempt \r\n + 
> next.match()
> failed. As a simple obvious sample both following should return true. 
> The existing
> implementation returns false for the second.
>
>     "\r\n".match("\\R")
>     "\r\n".match("\\R\\n")

"\r\n".matches("\\R")
"\r\n".matches("\\R\\n")

>
> Thanks,
> Sherman



More information about the core-libs-dev mailing list