On 10/10/06, Anton Ivanov <[EMAIL PROTECTED]> wrote:
On 10/10/06, Tim Ellison <[EMAIL PROTECTED]> wrote: > > So I checked in a patch for HARMONY-688's regex fix, and it passed the > regex unit tests, but causes the existing luni tests to fail in > java.util.Scanner. I've not figured out the base cause of the failure > so I've backed out the changes. > > Regards, > Tim > > -- > > Tim Ellison ([EMAIL PROTECTED] ) > IBM Java technology centre, UK. > > --------------------------------------------------------------------- > Terms of use : http://incubator.apache.org/harmony/mailing.html > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] This is my patch. I'll look into this problem and try to correct the patch. Thanks, Anton
There was a bug in the newly created class SupplRangeSet.java. There was the following code in the method matches() of SupplRangeSet.java: ... if (stringIndex < strLength) { char high = testString.charAt(stringIndex++); if (contains(high) && next.matches(stringIndex, testString, matchResult) > 0) { return 1; } ... But it is wrong simply to return 1, though we can read about method matches() in AbstractSet.java comments: "Checks if this node matches in given position and recursively call next node matches on positive self match. Returns positive integer if entire match succeed, negative otherwise return -1 if match fails or n > 0;" In fact method matches() returns not only a positive n > 0. The n is an offset in case of a positive match attempt. This fact is took into account in all old classes of java.util.regex, but I forgot this fact in SupplRangeSet.java So I corrected method matches() of the SupplRangeSet class as follows: ... int offset = -1; if (stringIndex < strLength) { char high = testString.charAt(stringIndex++); if (contains(high) && (offset = next.matches(stringIndex, testString, matchResult)) > 0) { return offset; } ... I corrected the patch and attached it to the issue. I verified that regex and luni tests pass normally with the patch applied. Thanks, Anton