[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commit-cp] [bugs #11728] String.split() function return worng results f
From: |
Timo Lindfors |
Subject: |
[commit-cp] [bugs #11728] String.split() function return worng results for a String with TAB delimiters "t" |
Date: |
Tue, 1 Feb 2005 21:43:20 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041217 |
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/
- [commit-cp] [bugs #11728] String.split() function return worng results for a String with TAB delimiters "t",
Timo Lindfors <=