You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/02/15 16:43:24 UTC
[GitHub] [commons-csv] angusdev opened a new pull request #216: CSV-288 Fix for double char delimiter (e.g. ||) not working as expected
angusdev opened a new pull request #216:
URL: https://github.com/apache/commons-csv/pull/216
Jira Issue: https://issues.apache.org/jira/browse/CSV-288
When checking if last token is delimiter in below line of code
```java
// did we reach eof during the last iteration already ? EOF
if (isEndOfFile(lastChar) || !isDelimiter(lastChar) && isEndOfFile(c)) {
```
`isDelimiter(lastChar)` unintentionally advance the buffer pointer and consume the first `"|"` when it comes to the `"b"` in `"a||b||c"` (lastChar is `"|"`, nextChar is also `"|"`, make it `"||"`). Subsequent read will see `"|c"` instead of `"||c"` so the second token is `"b|c"`
To fix it, create a new indicator `isLastTokenDelimiter` instead of using `isDelimiter(lastChar)`, the indicator is set/reset in `isDelimiter()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org