File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed
main/java/org/embulk/parser/csv
test/java/org/embulk/parser/csv Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -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 ));
@@ -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 }
Original file line number Diff line number Diff line change 1616
1717package org .embulk .parser .csv ;
1818
19- public class QuotedSizeLimitExceededException extends InvalidCsvQuotationException {
20- public QuotedSizeLimitExceededException (final String message ) {
21- super (message );
19+ public class QuotedFieldLengthLimitExceededException extends InvalidCsvQuotationException {
20+ public QuotedFieldLengthLimitExceededException (final long quotedFieldLengthLimit ) {
21+ super ("The length of the quoted field exceeds the limit (" + quotedFieldLengthLimit + ")" );
22+ this .quotedFieldLengthLimit = quotedFieldLengthLimit ;
2223 }
24+
25+ private final long quotedFieldLengthLimit ;
2326}
Original file line number Diff line number Diff line change @@ -338,7 +338,7 @@ public void parseWithQuotesInQuotedFields_ACCEPT_STRAY_QUOTES_ASSUMING_NO_DELIMI
338338 }
339339
340340 @ Test
341- public void throwQuotedSizeLimitExceededException () throws Exception {
341+ public void throwQuotedFieldLengthLimitExceededException () throws Exception {
342342 final CsvTokenizer .Builder builder = initialBuilder ();
343343 builder .setMaxQuotedFieldLength (8 );
344344
@@ -348,7 +348,7 @@ public void throwQuotedSizeLimitExceededException() throws Exception {
348348 "v3,\" 0123456789\" " );
349349 fail ();
350350 } catch (Exception e ) {
351- assertTrue (e instanceof QuotedSizeLimitExceededException );
351+ assertTrue (e instanceof QuotedFieldLengthLimitExceededException );
352352 }
353353
354354 // multi-line
@@ -358,12 +358,12 @@ public void throwQuotedSizeLimitExceededException() throws Exception {
358358 "\" 012345\n 6789\" ,v3" );
359359 fail ();
360360 } catch (Exception e ) {
361- assertTrue (e instanceof QuotedSizeLimitExceededException );
361+ assertTrue (e instanceof QuotedFieldLengthLimitExceededException );
362362 }
363363 }
364364
365365 @ Test
366- public void recoverFromQuotedSizeLimitExceededException () throws Exception {
366+ public void recoverFromQuotedFieldLengthLimitExceededException () throws Exception {
367367 final CsvTokenizer .Builder builder = initialBuilder ();
368368 builder .setMaxQuotedFieldLength (12 );
369369
@@ -388,7 +388,7 @@ public void recoverFromQuotedSizeLimitExceededException() throws Exception {
388388 tokenizer .nextColumn ();
389389 fail ();
390390 } catch (Exception e ) {
391- assertTrue (e instanceof QuotedSizeLimitExceededException );
391+ assertTrue (e instanceof QuotedFieldLengthLimitExceededException );
392392 }
393393 assertEquals ("v3,\" 0123" , tokenizer .skipCurrentLine ());
394394
You can’t perform that action at this time.
0 commit comments