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 2011/11/09 15:54:06 UTC

svn commit: r1199780 - 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: Wed Nov  9 14:54:05 2011
New Revision: 1199780

URL: http://svn.apache.org/viewvc?rev=1199780&view=rev
Log:
Removed CSVParser.nextValue() (SANDBOX-220)

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=1199780&r1=1199779&r2=1199780&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 Wed Nov  9 14:54:05 2011
@@ -166,35 +166,6 @@ public class CSVParser {
     }
 
     /**
-     * Parses the CSV according to the given strategy
-     * and returns the next csv-value as string.
-     *
-     * @return next value in the input stream ('null' when end of file)
-     * @throws IOException on parse error or input read-failure
-     */
-    public String nextValue() throws IOException {
-        Token tkn = nextToken();
-        String ret = null;
-        switch (tkn.type) {
-            case TT_TOKEN:
-            case TT_EORECORD:
-                ret = tkn.content.toString();
-                break;
-            case TT_EOF:
-                ret = null;
-                break;
-            case TT_INVALID:
-            default:
-                // error no token available (or error)
-                throw new IOException(
-                        "(line " + getLineNumber()
-                                + ") invalid parse sequence");
-                // unreachable: break;
-        }
-        return ret;
-    }
-
-    /**
      * Parses from the current point in the stream til
      * the end of the current line.
      *

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=1199780&r1=1199779&r2=1199780&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 Wed Nov  9 14:54:05 2011
@@ -221,19 +221,6 @@ public class CSVParserTest extends TestC
         assertTrue(tmp == null);
     }
 
-    public void testNextValue() throws IOException {
-        CSVParser parser = new CSVParser(new StringReader(code));
-        String tmp = null;
-        for (int i = 0; i < res.length; i++) {
-            for (int j = 0; j < res[i].length; j++) {
-                tmp = parser.nextValue();
-                assertEquals(res[i][j], tmp);
-            }
-        }
-        tmp = parser.nextValue();
-        assertTrue(tmp == null);
-    }
-
     public void testGetAllValues() throws IOException {
         CSVParser parser = new CSVParser(new StringReader(code));
         String[][] tmp = parser.getAllValues();
@@ -571,20 +558,6 @@ public class CSVParserTest extends TestC
         assertEquals(3, data.length);
     }
 
-    public void testLineTokenConsistency() throws IOException {
-        String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n";
-        CSVParser parser = new CSVParser(new StringReader(code));
-        String[][] data = parser.getAllValues();
-        parser = new CSVParser(new StringReader(code));
-        CSVParser parser1 = new CSVParser(new StringReader(code));
-        for (int i = 0; i < data.length; i++) {
-            assertTrue(Arrays.equals(parser1.getLine(), data[i]));
-            for (int j = 0; j < data[i].length; j++) {
-                assertEquals(parser.nextValue(), data[i][j]);
-            }
-        }
-    }
-
     // From SANDBOX-153
     public void testDelimiterIsWhitespace() throws IOException {
         String code = "one\ttwo\t\tfour \t five\t six";