Hi, macsharker6 The reason for not finding the CSV-241 patch source code in version 1.7 is that the CSV-241 patch was submitted to the main branch after the 1.7 release.
According to the changes.xml content, the patch will be released in version 1.8. hope this helps :) Silence Tai ________________________________ 发件人: macsharker6 <[email protected]> 发送时间: 2019年9月9日 23:38 收件人: [email protected] <[email protected]> 主题: Fw: Probably bug in the method "withAllowDuplicateHeaderNames" for the class CSVFormat Hi, why in the link: https://github.com/apache/commons-csv/commit/d6e494b44d85540923b39eb4956a704ecee295b1 the bug fixed in the issue: https://issues.apache.org/jira/browse/CSV-241 is in the commit of the releasde 1.7 but in the source code didn't find it? Regards. macsharker6 Sent with [ProtonMail](https://protonmail.com) Secure Email. �\�\�\�\�\�\�\ Original Message �\�\�\�\�\�\�\ Il martedì 3 settembre 2019 16:57, macsharker6 <[email protected]> ha scritto: > Hi, > I am a Java programmer and I am using the last version of common-csv library, > such as in my pom.xml I have this dependency: > > <dependency> > <groupId>org.apache.commons</groupId> > <artifactId>commons-csv</artifactId> > <version>1.7</version> > </dependency> > > This library is used in order to write a simple CSV file in a java > application. In particular use cases the column name headers of the csv file > can be duplicated. > I found an interesting property of the CSVFormat class that must be useful in > this case but, in every solution described below, the program terminates with > error such as: > > Exception in thread "main" java.lang.IllegalArgumentException: The header > contains a duplicate entry: 'VV' in [CC, VV, VV] > at org.apache.commons.csv.CSVFormat.validate(CSVFormat.java:1676) > at org.apache.commons.csv.CSVFormat.<init>(CSVFormat.java:793) > at org.apache.commons.csv.CSVFormat.withHeader(CSVFormat.java:1986) > > The code written is: > > public static void main(String[] args){ > CSVFormat formatCsv = > CSVFormat.DEFAULT.withAllowDuplicateHeaderNames().withHeader("CC","VV","VV"); > System.out.println(formatCsv); > } > > I tried 4 situations: > > 1) > CSVFormat formatCsv = > CSVFormat.DEFAULT.withAllowDuplicateHeaderNames().withHeader(headers); > 2) > CSVFormat formatCsv = > CSVFormat.DEFAULT.withAllowDuplicateHeaderNames(true).withHeader(headers); > 3) > CSVFormat formatCsv = > CSVFormat.DEFAULT.withHeader(headers).withAllowDuplicateHeaderNames(); > 4) > CSVFormat formatCsv = > CSVFormat.DEFAULT.withHeader(headers).withAllowDuplicateHeaderNames(true); > > There is a bug for the withAllowDuplicateHeaderNames property? > > Thanks for your answer. > > I think that is a Jira Open: > https://jira.apache.org/jira/browse/CSV-236 > > Regards. > > macsharker6 > > Sent with [ProtonMail](https://protonmail.com) Secure Email.
