Skip to content

Commit fc4ccb4

Browse files
committed
Removed CSVParser.nextValue() (SANDBOX-220)
git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1199780 13f79535-47bb-0310-9956-ffa450edef68
1 parent d90fa38 commit fc4ccb4

2 files changed

Lines changed: 0 additions & 56 deletions

File tree

src/main/java/org/apache/commons/csv/CSVParser.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -165,35 +165,6 @@ public String[][] getAllValues() throws IOException {
165165
return ret;
166166
}
167167

168-
/**
169-
* Parses the CSV according to the given strategy
170-
* and returns the next csv-value as string.
171-
*
172-
* @return next value in the input stream ('null' when end of file)
173-
* @throws IOException on parse error or input read-failure
174-
*/
175-
public String nextValue() throws IOException {
176-
Token tkn = nextToken();
177-
String ret = null;
178-
switch (tkn.type) {
179-
case TT_TOKEN:
180-
case TT_EORECORD:
181-
ret = tkn.content.toString();
182-
break;
183-
case TT_EOF:
184-
ret = null;
185-
break;
186-
case TT_INVALID:
187-
default:
188-
// error no token available (or error)
189-
throw new IOException(
190-
"(line " + getLineNumber()
191-
+ ") invalid parse sequence");
192-
// unreachable: break;
193-
}
194-
return ret;
195-
}
196-
197168
/**
198169
* Parses from the current point in the stream til
199170
* the end of the current line.

src/test/java/org/apache/commons/csv/CSVParserTest.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -221,19 +221,6 @@ public void testGetLine() throws IOException {
221221
assertTrue(tmp == null);
222222
}
223223

224-
public void testNextValue() throws IOException {
225-
CSVParser parser = new CSVParser(new StringReader(code));
226-
String tmp = null;
227-
for (int i = 0; i < res.length; i++) {
228-
for (int j = 0; j < res[i].length; j++) {
229-
tmp = parser.nextValue();
230-
assertEquals(res[i][j], tmp);
231-
}
232-
}
233-
tmp = parser.nextValue();
234-
assertTrue(tmp == null);
235-
}
236-
237224
public void testGetAllValues() throws IOException {
238225
CSVParser parser = new CSVParser(new StringReader(code));
239226
String[][] tmp = parser.getAllValues();
@@ -571,20 +558,6 @@ public void testIgnoreEmptyLines() throws IOException {
571558
assertEquals(3, data.length);
572559
}
573560

574-
public void testLineTokenConsistency() throws IOException {
575-
String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n";
576-
CSVParser parser = new CSVParser(new StringReader(code));
577-
String[][] data = parser.getAllValues();
578-
parser = new CSVParser(new StringReader(code));
579-
CSVParser parser1 = new CSVParser(new StringReader(code));
580-
for (int i = 0; i < data.length; i++) {
581-
assertTrue(Arrays.equals(parser1.getLine(), data[i]));
582-
for (int j = 0; j < data[i].length; j++) {
583-
assertEquals(parser.nextValue(), data[i][j]);
584-
}
585-
}
586-
}
587-
588561
// From SANDBOX-153
589562
public void testDelimiterIsWhitespace() throws IOException {
590563
String code = "one\ttwo\t\tfour \t five\t six";

0 commit comments

Comments
 (0)