Github user LosD commented on a diff in the pull request:
https://github.com/apache/metamodel/pull/83#discussion_r47944152
--- Diff: csv/src/main/java/org/apache/metamodel/csv/CsvWriter.java ---
@@ -72,23 +72,38 @@ public String buildLine(String[] nextLine) {
}
private boolean stringContainsSpecialCharacters(String line) {
- return line.indexOf(_configuration.getQuoteChar()) != -1 ||
line.indexOf(_configuration.getEscapeChar()) != -1;
+ boolean result = line.indexOf(_configuration.getQuoteChar()) != -1
+ || line.indexOf(_configuration.getEscapeChar()) != -1;
+ if (!result) {
+ result = _configuration.getQuoteChar() ==
CsvConfiguration.NOT_A_CHAR
+ && _configuration.getEscapeChar() !=
CsvConfiguration.NOT_A_CHAR;
--- End diff --
I have a hard time understanding this part: In the previous lines, if the
line doesn't contain a quote char AND doesn't contain an escape char, result
would be false.
But here (line 77-79), if quote is not set, and escape is, we pretend one
of them was contained anyway? It seems to me that the method is either misnamed
or mis-implemented.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---