Skip to content

Commit

Permalink
[Fix] Change default quote character to "
Browse files Browse the repository at this point in the history
In addition, [Fix] remove messages about choosing default values for delimiter and quote character
  • Loading branch information
blcham committed Feb 5, 2023
1 parent 1ba859a commit 2ec48b8
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,23 +382,27 @@ private void setInputCharset(int delimiter) {
}
}
private Supplier<Character> getDefaultDelimiterSupplier() {
LOG.debug("Delimiter not specified, using comma as default value to be compliant with RFC 4180 (CSV).");
return () -> ',';
return () -> {
LOG.debug("Delimiter not specified, using comma as default value to be compliant with RFC 4180 (CSV).");
return ',';
};
}

private Supplier<Character> getDefaultQuoteCharacterSupplier(int delimiter) {
if (delimiter != ',') {
return () -> '\0';
}
LOG.debug("Quote character not specified, using double-quote as default value to be compliant with RFC 4180 (CSV)");
return () -> ',';
return () -> {
LOG.debug("Quote character not specified, using double-quote as default value to be compliant with RFC 4180 (CSV)");
return '"';
};
}

private char getPropertyValue(Property property,
Supplier<Character> defaultValueSupplier) {
return Optional.ofNullable(getPropertyValue(property))
.map(n -> n.asLiteral().getChar())
.orElse(defaultValueSupplier.get());
.orElseGet(defaultValueSupplier);
}

@Override
Expand Down

0 comments on commit 2ec48b8

Please sign in to comment.