Skip to content

Commit

Permalink
Git one last test failure wrt #15 on 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 8, 2019
1 parent 32437c0 commit d39071a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Expand Up @@ -267,8 +267,8 @@ public CsvDecoder(CsvParser owner, IOContext ctxt, Reader r, CsvSchema schema,
_inputSource = r;
_textBuffer = textBuffer;
_autoCloseInput = JsonParser.Feature.AUTO_CLOSE_SOURCE.enabledIn(stdFeatures);
final boolean legacy = JsonParser.Feature.ALLOW_YAML_COMMENTS.enabledIn(stdFeatures);
_allowComments = legacy | CsvParser.Feature.ALLOW_COMMENTS.enabledIn(csvFeatures);
final boolean oldComments = JsonParser.Feature.ALLOW_YAML_COMMENTS.enabledIn(stdFeatures);
_allowComments = oldComments | CsvParser.Feature.ALLOW_COMMENTS.enabledIn(csvFeatures);
_trimSpaces = CsvParser.Feature.TRIM_SPACES.enabledIn(csvFeatures);
_skipBlankLines = CsvParser.Feature.SKIP_EMPTY_LINES.enabledIn(csvFeatures);
_inputBuffer = ctxt.allocTokenBuffer();
Expand All @@ -284,7 +284,9 @@ public void setSchema(CsvSchema schema)
_separatorChar = schema.getColumnSeparator();
_quoteChar = schema.getQuoteChar();
_escapeChar = schema.getEscapeChar();
_allowComments = _allowComments | schema.allowsComments();
if (!_allowComments) {
_allowComments = schema.allowsComments();
}
int max = Math.max(_separatorChar, _quoteChar);
max = Math.max(max, _escapeChar);
max = Math.max(max, '\r');
Expand All @@ -298,6 +300,12 @@ public void setSchema(CsvSchema schema)
public void overrideFormatFeatures(int csvFeatures) {
_trimSpaces = CsvParser.Feature.TRIM_SPACES.enabledIn(csvFeatures);
_skipBlankLines = CsvParser.Feature.SKIP_EMPTY_LINES.enabledIn(csvFeatures);

// 07-Oct-2019, tatu: not 100% accurate, as we have no access to legacy
// setting. But close enough, fixed in 3.0
if (CsvParser.Feature.ALLOW_COMMENTS.enabledIn(csvFeatures)) {
_allowComments = true;
}
}

/*
Expand Down
Expand Up @@ -90,6 +90,7 @@ public void testCsvWithBlankLineAndCommentSkipBlankLinesFeatureEnabledAndAllowCo
.with(CsvParser.Feature.ALLOW_COMMENTS)
.readValue(CSV_WITH_BLANK_LINE_AND_COMMENT);
// blank/empty/comment lines are skipped

assertArrayEquals(expected(
row("1", "xyz"),
row("true", "")
Expand Down

0 comments on commit d39071a

Please sign in to comment.