Skip to content

Commit 8462234

Browse files
committed
We don't care if trailing LF has been consumed
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1306797 13f79535-47bb-0310-9956-ffa450edef68
1 parent a5b76b6 commit 8462234

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/main/java/org/apache/commons/csv/CSVLexer.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ Token nextToken(Token tkn) throws IOException {
4545

4646
// read the next char and set eol
4747
int c = in.read();
48-
49-
/* note: unfortunately isEndOfLine may consumes a character silently.
50-
* this has no effect outside of the method. so a simple workaround
51-
* is to call 'readAgain' on the stream...
52-
*/
48+
/*
49+
* Note:
50+
* The following call will swallow LF if c == CR.
51+
* But we don't need to know if the last char
52+
* was CR or LF - they are equivalent here.
53+
*/
5354
boolean eol = isEndOfLine(c);
54-
c = in.readAgain();
5555

5656
// empty line detection: eol AND (last char was EOL or beginning)
5757
if (emptyLinesIgnored) {
@@ -60,7 +60,6 @@ Token nextToken(Token tkn) throws IOException {
6060
lastChar = c;
6161
c = in.read();
6262
eol = isEndOfLine(c);
63-
c = in.readAgain();
6463
// reached end of file without any content (empty line at the end)
6564
if (isEndOfFile(c)) {
6665
tkn.type = EOF;

0 commit comments

Comments
 (0)