Cleanup for Codacy and better parsing of quote character
This commit is contained in:
parent
a89bbcbbe2
commit
f5ff5565ff
@ -103,8 +103,8 @@ public class SeparatorBasedImporter extends TabularImportingParserBase {
|
|||||||
|
|
||||||
Character quote = CSVParser.DEFAULT_QUOTE_CHARACTER;
|
Character quote = CSVParser.DEFAULT_QUOTE_CHARACTER;
|
||||||
String quoteCharacter = JSONUtilities.getString(options, "quoteCharacter", null);
|
String quoteCharacter = JSONUtilities.getString(options, "quoteCharacter", null);
|
||||||
if (!StringUtils.isBlank(quoteCharacter)) {
|
if (quoteCharacter != null && quoteCharacter.trim().length() == 1) {
|
||||||
quote = quoteCharacter.charAt(0);
|
quote = quoteCharacter.trim().charAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
final CSVParser parser = new CSVParser(
|
final CSVParser parser = new CSVParser(
|
||||||
|
@ -489,7 +489,7 @@ public class TsvCsvImporterTests extends ImporterTest {
|
|||||||
|
|
||||||
|
|
||||||
@Test(dataProvider = "CSV-TSV-AutoDetermine")
|
@Test(dataProvider = "CSV-TSV-AutoDetermine")
|
||||||
public void readSimpleData_CSV_1Header_1Row_singleQuote(String sep){
|
public void customQuoteCharacter(String sep){
|
||||||
//create input to test with
|
//create input to test with
|
||||||
String inputSeparator = sep == null ? "\t" : sep;
|
String inputSeparator = sep == null ? "\t" : sep;
|
||||||
String input = "'col1'" + inputSeparator + "'col2'" + inputSeparator + "'col3'\n" +
|
String input = "'col1'" + inputSeparator + "'col2'" + inputSeparator + "'col3'\n" +
|
||||||
|
Loading…
Reference in New Issue
Block a user