[JAVA-26720] Upgraded opencsv to 5.8 version (#15126)
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
<source.version>11</source.version>
|
||||
<target.version>11</target.version>
|
||||
<json.version>20200518</json.version>
|
||||
<opencsv.version>4.1</opencsv.version>
|
||||
<opencsv.version>5.8</opencsv.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -58,7 +58,7 @@
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<opencsv.version>4.1</opencsv.version>
|
||||
<opencsv.version>5.8</opencsv.version>
|
||||
<spring-core.version>5.3.13</spring-core.version>
|
||||
<apache-commons-lang3.version>3.12.0</apache-commons-lang3.version>
|
||||
<apache-commons-text.version>1.10.0</apache-commons-text.version>
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@ import com.opencsv.CSVParser;
|
||||
import com.opencsv.CSVParserBuilder;
|
||||
import com.opencsv.CSVReader;
|
||||
import com.opencsv.CSVReaderBuilder;
|
||||
import com.opencsv.exceptions.CsvException;
|
||||
|
||||
public class SplitCommaSeparatedString {
|
||||
|
||||
@@ -50,7 +51,7 @@ public class SplitCommaSeparatedString {
|
||||
return splitter.splitToList(input);
|
||||
}
|
||||
|
||||
public static List<String[]> splitMultiLineWithOpenCSV(String input) throws IOException {
|
||||
public static List<String[]> splitMultiLineWithOpenCSV(String input) throws IOException, CsvException {
|
||||
CSVParser parser = new CSVParserBuilder().withSeparator(',')
|
||||
.build();
|
||||
|
||||
|
||||
+3
-1
@@ -14,6 +14,8 @@ import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.opencsv.exceptions.CsvException;
|
||||
|
||||
public class SplitCommaSeparatedStringUnitTest {
|
||||
|
||||
@Test
|
||||
@@ -27,7 +29,7 @@ public class SplitCommaSeparatedStringUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenMultiLineInput_whenParsing_shouldIgnoreCommasInsideDoubleQuotes() throws IOException {
|
||||
public void givenMultiLineInput_whenParsing_shouldIgnoreCommasInsideDoubleQuotes() throws IOException, CsvException {
|
||||
String input = "baeldung,tutorial,splitting,text,\"ignoring this comma,\"" + System.lineSeparator()
|
||||
+ "splitting,a,regular,line,no double quotes";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user