6520207: Dollar/UnixDollar bad behavior shouldn't match twice in "\n"

ilgo ilgo711 at gmail.com
Sun Jul 5 06:23:56 UTC 2009

Hi there,

i am new here....so i need to learn how to communicate properly...

i have been working on java.util.regex bug no.
6520207<http://bugs.sun.com/view_bug.do?bug_id=6520207>. I found a two
line fix and all the tests that come with the openJDK source
belonging to the regex package seem to work fine.

The change i implemented is the following:

Pattern.java at line 3374 inserting

* 3374:   if (matcher.first == endIndex && seq.charAt(i - 1) == '\n')
 3375:       return false;*

the "$" pattern matches "a\nb\nc\n" twice. At the end of the last
line-terminator as well as at the end of input.
Since the second match is matching only the end of input and no real
characters, i first check if the new match starts at the end of input, and
since this bug only occurs with a '\n' as the last character in the string
to be matched, i check for that too. If this is the case then we dont want
to match anymore, so return false.

Regards ilgo

PS: how do i go on from here...?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20090705/0492f99a/attachment.html>

More information about the core-libs-dev mailing list