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/12 16:12:55 UTC
svn commit: r1299706 -
/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
Author: ebourg
Date: Mon Mar 12 15:12:55 2012
New Revision: 1299706
URL: http://svn.apache.org/viewvc?rev=1299706&view=rev
Log:
Changed while loops (CSV-55)
Modified:
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1299706&r1=1299705&r2=1299706&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Mon Mar 12 15:12:55 2012
@@ -143,7 +143,7 @@ public class CSVParser implements Iterab
String[] getRecord() throws IOException {
String[] result = EMPTY_STRING_ARRAY;
record.clear();
- while (true) {
+ do {
reusableToken.reset();
lexer.nextToken(reusableToken);
switch (reusableToken.type) {
@@ -165,10 +165,8 @@ public class CSVParser implements Iterab
throw new IOException("(line " + getLineNumber() + ") invalid parse sequence");
// unreachable: break;
}
- if (reusableToken.type != TOKEN) {
- break;
- }
- }
+ } while (reusableToken.type == TOKEN);
+
if (!record.isEmpty()) {
result = record.toArray(new String[record.size()]);
}
@@ -403,7 +401,7 @@ class CSVLexer {
* @throws IOException on stream access error
*/
private Token simpleTokenLexer(Token tkn, int c) throws IOException {
- for (; ;) {
+ while (true) {
if (isEndOfLine(c)) {
// end of record
tkn.type = EORECORD;
@@ -454,7 +452,7 @@ class CSVLexer {
int startLineNumber = getLineNumber();
// ignore the given delimiter
// assert c == delimiter;
- for (; ;) {
+ while (true) {
c = in.read();
if (c == format.getEscape()) {
@@ -466,7 +464,7 @@ class CSVLexer {
tkn.content.append((char) c);
} else {
// token finish mark (encapsulator) reached: ignore whitespace till delimiter
- for (; ;) {
+ while (true) {
c = in.read();
if (c == format.getDelimiter()) {
tkn.type = TOKEN;