commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-cp] RE: [bugs #11728] String.split() function return worng resul


From: Amit Jain
Subject: [commit-cp] RE: [bugs #11728] String.split() function return worng results for a String with TAB delimiters "t"
Date: Tue, 01 Feb 2005 13:57:54 -0800

Thanks Timo for looking in to this.

I am using open source for the first time. How does this fix get in to the GNU source codes for future releases.

Who is going to own this fix? You?

-Amit
From: Timo Lindfors <address@hidden>
To: Amit <address@hidden>, Timo Lindfors <address@hidden>, address@hidden Subject: [bugs #11728] String.split() function return worng results for a String with TAB delimiters "t"
Date: Tue, 1 Feb 2005 21:43:20 +0000

Follow-up Comment #1, bugs #11728 (project classpath):

I'm not sure but it seems to me that this is caused by
the construct

while (...) {
  ...
  while(empties-- > 0)
    list.add("");
  ...
}

in java.util.regex.Pattern.split(input, limit). Idea is probably to call
list.add empties times. However, if empties is already zero the construct
will decrease it to -1. This will cause incorrect behavior on next iteration
of the while loop and skip one empty token.

The attached patch works for me and your testcase.
    _______________________________________________________

Additional Item Attachment:

File name: regex-pattern.diff             Size:0 KB
proposed patch
<http://savannah.gnu.org/bugs/download.php?item_id=11728&item_file_id=2137>

    _______________________________________________________

This item URL is:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=11728>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]