mykolaf opened a new pull request, #266: URL: https://github.com/apache/commons-csv/pull/266
Signed-off-by: Mykola Faryma <[email protected]> The addition of String delimiter support opened a new opportunity to set the delimiter as empty string. This situation will result in `NegativeArraySizeException` (see example below). I propose to enhance argument checking in `setDelimiter(String delimiter)` to get explicit and helpful exception in such case. Log: ``` Exception in thread "main" java.lang.NegativeArraySizeException: -1 at org.apache.commons.csv.Lexer.<init>(Lexer.java:75) at org.apache.commons.csv.CSVParser.<init>(CSVParser.java:435) at org.apache.commons.csv.CSVParser.<init>(CSVParser.java:403) at org.apache.commons.csv.CSVParser.parse(CSVParser.java:303) at Test.main(Test.java:10) ``` Test code: ``` import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import java.io.StringReader; public class Test { public static void main(String[] args) throws Exception { CSVParser.parse("abcd", CSVFormat.Builder.create().setDelimiter("").build()); } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
