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

svn commit: r1297431 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/CSVParser.java test/java/org/apache/commons/csv/CSVParserTest.java

Author: ebourg
Date: Tue Mar  6 11:23:04 2012
New Revision: 1297431

URL: http://svn.apache.org/viewvc?rev=1297431&view=rev
Log:
Removed the package private method CSVParser.nextToken()

Modified:
    commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
    commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java

Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1297431&r1=1297430&r2=1297431&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original)
+++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Tue Mar  6 11:23:04 2012
@@ -179,7 +179,7 @@ public class CSVParser implements Iterab
     }
 
     /**
-     * Parses from the current point in the stream til * the end of the current line.
+     * Parses from the current point in the stream til the end of the current line.
      *
      * @return array of values til end of line ('null' when end of file has been reached)
      * @throws IOException on parse error or input read-failure
@@ -280,13 +280,6 @@ public class CSVParser implements Iterab
     // ======================================================
 
     /**
-     * Convenience method for <code>nextToken(null)</code>.
-     */
-    Token nextToken() throws IOException {
-        return nextToken(new Token());
-    }
-
-    /**
      * Returns the next token.
      * <p/>
      * A token corresponds to a term, a record change or an end-of-file indicator.
@@ -580,11 +573,9 @@ public class CSVParser implements Iterab
      */
     private boolean isEndOfLine(int c) throws IOException {
         // check if we have \r\n...
-        if (c == '\r') {
-            if (in.lookAhead() == '\n') {
-                // note: does not change c outside of this method !!
-                c = in.read();
-            }
+        if (c == '\r' && in.lookAhead() == '\n') {
+            // note: does not change c outside of this method !!
+            c = in.read();
         }
         return (c == '\n' || c == '\r');
     }

Modified: commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1297431&r1=1297430&r2=1297431&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java (original)
+++ commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Tue Mar  6 11:23:04 2012
@@ -63,10 +63,10 @@ public class CSVParserTest extends TestC
          * type and content.
          *
          * @return String representation of token type and content
-         * @throws IOException like {@link CSVParser#nextToken()}
+         * @throws IOException like {@link CSVParser#nextToken(Token)}
          */
         public String testNextToken() throws IOException {
-            Token t = super.nextToken();
+            Token t = super.nextToken(new Token());
             return t.type.name() + ";" + t.content + ";";
         }
     }