You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2013/06/21 03:49:04 UTC

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

Author: ggregory
Date: Fri Jun 21 01:49:03 2013
New Revision: 1495269

URL: http://svn.apache.org/r1495269
Log:
Fix possible NPE reported by FindBugs.

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=1495269&r1=1495268&r2=1495269&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 Fri Jun 21 01:49:03 2013
@@ -86,7 +86,13 @@ final class CSVLexer extends Lexer {
         }
 
         if (isStartOfLine(lastChar) && isCommentStart(c)) {
-            final String comment = in.readLine().trim();
+            String line = in.readLine();
+            if (line == null) {
+                token.type = EOF;
+                // don't set token.isReady here because no content
+                return token;                
+            }
+            final String comment = line.trim();
             token.content.append(comment);
             token.type = COMMENT;
             return token;