Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ public CsvSchema withoutEscapeChar() {
public CsvSchema withArrayElementSeparator(String separator) {
String sep = separator == null ? "" : separator;
return (_arrayElementSeparator.equals(sep)) ? this : new CsvSchema(_columns, _features,
_columnSeparator, _quoteChar, _escapeChar, _lineSeparator, separator,
_columnSeparator, _quoteChar, _escapeChar, _lineSeparator, sep,
_nullValue, _columnsByName, _anyPropertyName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,21 @@ public void testSchemaWithExplicitIndices()

_verifyLinks(pointSchema);
}

// [dataformats-text#710]: withArrayElementSeparator(null) should normalize
// to "no separator" (like the local `sep` used for the equality check), not
// store a null that later NPEs in hasArrayElementSeparator()
@Test
public void testWithArrayElementSeparatorNull()
{
CsvSchema schema = CsvSchema.emptySchema().withArrayElementSeparator(";");
assertTrue(schema.hasArrayElementSeparator());

CsvSchema cleared = schema.withArrayElementSeparator(null);
assertFalse(cleared.hasArrayElementSeparator());
assertEquals("", cleared.getArrayElementSeparator());

// and calling it again must not throw
assertFalse(cleared.withArrayElementSeparator(null).hasArrayElementSeparator());
}
}
6 changes: 6 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,9 @@ Michał Majchrowicz (@sectroyer)
* Reported #707: (yaml) `StackOverflowError` when reading deeply nested merge keys
(`<<`) with `YAMLAnchorReplayingFactory` (GHSA-255r-36wv-4qpr)
(2.21.6)

Uttam Limbani (@uttam12331)

* Fixed #710: (csv) `CsvSchema.withArrayElementSeparator(null)` stores `null`,
causing `NullPointerException` from `hasArrayElementSeparator()`
(2.21.6)
3 changes: 3 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Active Maintainers:

2.21.6 (not yet released)

#710: (csv) `CsvSchema.withArrayElementSeparator(null)` stores `null`, causing
`NullPointerException` from `hasArrayElementSeparator()`
(fix by @uttam12331)
#701: (yaml) `ALWAYS_QUOTE_NUMBERS_AS_STRINGS` does not quote YAML 1.1 exponent
(`1e5`), hex (`0x1F`) and underscore (`12_34`) number forms
(reported by @EverNife)
Expand Down