Skip to content

Commit 8b53707

Browse files
committed
changed the " " symbol processing
1 parent af4fa5f commit 8b53707

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/org/labkey/test/util/data/TestDataUtils.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -578,17 +578,16 @@ public static List<List<String>> readRowsFromFile(File file, CSVFormat format) t
578578
}
579579
}
580580

581-
public static List<String> parseMultiValueText(String multiValueString) throws IOException
581+
public static String parseMultiValueText(String multiValueString) throws IOException
582582
{
583583
CSVFormat format = CSVFormat.RFC4180.builder()
584-
.setIgnoreSurroundingSpaces(true).get();
584+
.setIgnoreSurroundingSpaces(true).setTrim(true).setQuote('"').get();
585585
try (CSVParser parser = format.parse(new StringReader(multiValueString)))
586586
{
587587
List<CSVRecord> records = parser.getRecords();
588-
List<List<String>> list = records.stream().map(CSVRecord::toList).toList();
589-
if (list.size() != 1)
590-
throw new IllegalArgumentException("Invalid multi-value text string: " + multiValueString);
591-
return list.getFirst();
588+
if (records.isEmpty())
589+
return "";
590+
return records.getFirst().stream().collect(Collectors.joining(multiValueString.contains(", ") ? ", " : ","));
592591
}
593592
}
594593

0 commit comments

Comments
 (0)