You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/03/29 14:03:53 UTC

svn commit: r1306797 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java

Author: sebb
Date: Thu Mar 29 12:03:53 2012
New Revision: 1306797

URL: http://svn.apache.org/viewvc?rev=1306797&view=rev
Log:
We don't care if trailing LF has been consumed

Modified:
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java?rev=1306797&r1=1306796&r2=1306797&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java Thu Mar 29 12:03:53 2012
@@ -45,13 +45,13 @@ class CSVLexer extends Lexer {
 
         //  read the next char and set eol
         int c = in.read();
-
-        /* note: unfortunately isEndOfLine may consumes a character silently.
-        *       this has no effect outside of the method. so a simple workaround
-        *       is to call 'readAgain' on the stream...
-        */
+        /*
+         * Note:
+         * The following call will swallow LF if c == CR.
+         * But we don't need to know if the last char
+         * was CR or LF - they are equivalent here.
+         */
         boolean eol = isEndOfLine(c);
-        c = in.readAgain();
 
         //  empty line detection: eol AND (last char was EOL or beginning)
         if (emptyLinesIgnored) {
@@ -60,7 +60,6 @@ class CSVLexer extends Lexer {
                 lastChar = c;
                 c = in.read();
                 eol = isEndOfLine(c);
-                c = in.readAgain();
                 // reached end of file without any content (empty line at the end)
                 if (isEndOfFile(c)) {
                     tkn.type = EOF;