Cleanup for Codacy and better parsing of quote character

This commit is contained in:
Antonin Delpeuch 2018-02-03 16:37:15 +00:00
parent a89bbcbbe2
commit f5ff5565ff
2 changed files with 3 additions and 3 deletions

View File

@ -103,8 +103,8 @@ public class SeparatorBasedImporter extends TabularImportingParserBase {
Character quote = CSVParser.DEFAULT_QUOTE_CHARACTER;
String quoteCharacter = JSONUtilities.getString(options, "quoteCharacter", null);
if (!StringUtils.isBlank(quoteCharacter)) {
quote = quoteCharacter.charAt(0);
if (quoteCharacter != null && quoteCharacter.trim().length() == 1) {
quote = quoteCharacter.trim().charAt(0);
}
final CSVParser parser = new CSVParser(

View File

@ -489,7 +489,7 @@ public class TsvCsvImporterTests extends ImporterTest {
@Test(dataProvider = "CSV-TSV-AutoDetermine")
public void readSimpleData_CSV_1Header_1Row_singleQuote(String sep){
public void customQuoteCharacter(String sep){
//create input to test with
String inputSeparator = sep == null ? "\t" : sep;
String input = "'col1'" + inputSeparator + "'col2'" + inputSeparator + "'col3'\n" +