commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1306797 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java
Date Thu, 29 Mar 2012 12:03:53 GMT
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;



Mime
View raw message