@@ -221,7 +221,7 @@ public boolean nextRecord() {
221221 public boolean nextRecord (final boolean skipEmptyLine ) {
222222 // If at the end of record, read the next line and initialize the state
223223 if (this .recordState != RecordState .END ) {
224- throw new TooManyColumnsException ( "Too many columns" );
224+ throw new RecordHasUnexpectedTrailingColumnException ( );
225225 }
226226
227227 final boolean hasNext = this .nextLine (skipEmptyLine );
@@ -260,7 +260,7 @@ public boolean hasNextColumn() {
260260
261261 public String nextColumn () {
262262 if (!this .hasNextColumn ()) {
263- throw new TooFewColumnsException ( "Too few columns" );
263+ throw new RecordDoesNotHaveExpectedColumnException ( );
264264 }
265265
266266 // reset last state
@@ -402,7 +402,7 @@ public String nextColumn() {
402402 quotedValue .append (this .newline );
403403 this .quotedValueLines .add (this .line );
404404 if (!this .nextLine (false )) {
405- throw new InvalidValueException ( "Unexpected end of line during parsing a quoted value" );
405+ throw new EndOfFileInQuotedFieldException ( );
406406 }
407407 valueStartPos = 0 ;
408408
@@ -423,7 +423,7 @@ public String nextColumn() {
423423 // A non-escaped stray "quote character" in the field is processed as a regular character
424424 // if ACCEPT_STRAY_QUOTES_ASSUMING_NO_DELIMITERS_IN_FIELDS is specified,
425425 if ((this .linePos - valueStartPos ) + quotedValue .length () > this .maxQuotedFieldLength ) {
426- throw new QuotedSizeLimitExceededException ( "The size of the quoted value exceeds the limit size (" + this .maxQuotedFieldLength + ")" );
426+ throw new QuotedFieldLengthLimitExceededException ( this .maxQuotedFieldLength );
427427 }
428428 } else {
429429 quotedValue .append (this .line .substring (valueStartPos , this .linePos - 1 ));
@@ -438,7 +438,7 @@ public String nextColumn() {
438438 quotedValue .append (this .line .substring (valueStartPos , this .linePos ));
439439 this .quotedValueLines .add (this .line );
440440 if (!this .nextLine (false )) {
441- throw new InvalidValueException ( "Unexpected end of line during parsing a quoted value" );
441+ throw new EndOfFileInQuotedFieldException ( );
442442 }
443443 valueStartPos = 0 ;
444444 } else if (this .isQuote (next ) || this .isEscape (next )) { // escaped quote
@@ -449,7 +449,7 @@ public String nextColumn() {
449449
450450 } else {
451451 if ((this .linePos - valueStartPos ) + quotedValue .length () > this .maxQuotedFieldLength ) {
452- throw new QuotedSizeLimitExceededException ( "The size of the quoted value exceeds the limit size (" + this .maxQuotedFieldLength + ")" );
452+ throw new QuotedFieldLengthLimitExceededException ( this .maxQuotedFieldLength );
453453 }
454454 // keep QUOTED_VALUE state
455455 }
@@ -473,7 +473,7 @@ public String nextColumn() {
473473 // column has trailing spaces and quoted. TODO should this be rejected?
474474
475475 } else {
476- throw new InvalidValueException ( String . format ( "Unexpected extra character '%c' after a value quoted by '%c'" , c , this .quote ) );
476+ throw new InvalidCharacterAfterQuoteException ( c , this .quote );
477477 }
478478 break ;
479479
0 commit comments