Re: [CSV] Odd behavior when using 'QuoteMode.MINIMAL' with empty columns

2023-09-05 Thread Buddhi De Silva
@garydgregory
Thank you for the explanation. I have closed the PR since it is no longer
needed.

On Mon, 4 Sept 2023 at 20:43, Gary Gregory  wrote:

> Buddhi,
>
> This example does not make sense because an empty header is illegal.
> You won't be able to parse the output generated by this code with the
> same CSVFormat.
>
> Assuming we are not setting headers to an empty array with:
>
> CSVFormat.DEFAULT.builder().setQuoteMode(QuoteMode.MINIMAL).build();
>
> Then, you will be able to parse the generated records.
>
> It does not matter that the output "looks odd" because you've asked
> for the MINIMAL format.
>
> If you change the code to produce larger output, then it is no longer
> minimal.
>
> Gary
>
> On Mon, Sep 4, 2023 at 10:38 AM Buddhi De Silva 
> wrote:
> >
> > Hello Commons-Dev team,
> >
> > I was trying samples with the 'setQuoteMode()' method in the 'CSVFormat'
> > class.
> > When I have a sting list as follows to be formatted,
> >
> > @Test
> > public void test_empty_columns() throws IOException {
> > CSVFormat csvFormat = CSVFormat.DEFAULT.builder()
> > .setHeader()
> > .setQuoteMode(QuoteMode.MINIMAL)
> > .build();
> >
> > CSVPrinter printer = new CSVPrinter(System.out, csvFormat);
> >
> > List tempStrList = new ArrayList<>();
> > tempStrList.add(new String[] { "", "col2", "", "col4" });
> > tempStrList.add(new String[] { "col1", "col2", "", "" });
> >
> > for (String[] temp1 : tempStrList) {
> > printer.printRecord(temp1);
> > }
> > printer.close();
> > }
> >
> > Above will print the following...
> >
> > "",col2,,col4
> > col1,col2,,
> >
> > If you have noticed properly, you will realize that in line 1, column 1
> it
> > is printing empty quotes ("") but not printing anything for line 1
> column 3.
> > This output looks a bit odd.
> >
> > When I was looking for the reason for the above behavior, I came across
> the
> > following comment added for the method 'printWithQuotes()' in class
> > 'CSVFormat'.
> >
> > case MINIMAL:
> > if (len <= 0) {
> > // Always quote an empty token that is the first
> > // on the line, as it may be the only thing on the
> > // line. If it were not quoted in that case,
> > // an empty line has no tokens.
> > if (newRecord) {
> > quote = true;
> > }
> > }
> > // other operations...
> >
> > However, I think we can optimize this behavior by introducing the total
> > length of values passed to the print method.
> > Please check the draft PR I have created (this PR is just to provide the
> > idea before actual refactoring):
> > https://github.com/apache/commons-csv/pull/351
> > If we apply changes as suggested in above PR, then we might be able to
> > produce more accurate output which will not print empty quotes for empty
> > first column.
> >
> > Appreciate your feedback on this.
> >
> > Thank You.
> > Buddhi De Silva.
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


Re: [VOTE][LAZY] Release Apache Commons Parent 62 based on RC1

2023-09-05 Thread Gary Gregory
My +1

Gary

On Sat, Sep 2, 2023 at 10:01 AM Gary Gregory  wrote:
>
> We have fixed one bug since Apache Commons Parent 61 was released, so I would 
> like to release Apache Commons Parent 62.
>
> Apache Commons Parent 62 RC1 is available for review here:
> https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1 (svn 
> revision 63744)
>
> The Git tag commons-parent-62-RC1 commit for this RC is 
> b07ecd5204794c818d0c885c05944c83830b3577 which you can browse here:
> 
> https://gitbox.apache.org/repos/asf?p=commons-parent.git;a=commit;h=b07ecd5204794c818d0c885c05944c83830b3577
> You may checkout this tag using:
> git clone https://gitbox.apache.org/repos/asf/commons-parent.git --branch 
> commons-parent-62-RC1 commons-parent-62-RC1
>
> Maven artifacts are here:
> 
> https://repository.apache.org/content/repositories/orgapachecommons-1653/org/apache/commons/commons-parent/62/
>
> These are the artifacts and their hashes:
>
> #Release SHA-512s
> #Sat Sep 02 09:54:14 EDT 2023
> commons-parent-62-bom.json=ea2fa1f0334cb99dc3a984886c0fbe7369fbb11017ba3e24b0b4541f1b1e45bda64c9cc156f6deb400c290979635ac330e949e75f5d3bd7a7d3c64ca024c
> commons-parent-62-site.xml=c6aea4f2c03920366bee23b08b046dacc09710e92c78ccd83f47cd92f89bc53abc3b8bbc7f44017ee94a2cb022ce763fe3f7d8c9aa42d571350269ba6568ca07
> commons-parent-62-bom.xml=a9dd18751162e1e7c737671e179c83c51c180869f40c98fda3a502d61e4f647553ea573fb0e8a7e3625df657ca6e4c94f8ffadd805b37b1d679e6ceeb613c119
> org.apache.commons_commons-parent-62.spdx.json=b05249edd0d8354c741b4fb2907402a0e31900c6ea1d6d704bd6bb4c6110976d6b49909d7352512a9ebd2129d9e7b5014e9068e87331c5414a07eac1a85c7066
> commons-parent-62-src.zip=2db114298e6b8bba06103802633ce32a8458a74a0d5e4530e6029f88e26a4f13aafa3f406c701e34f28553a6dea03b271c727d7227dec5feec53a07200f63160
> commons-parent-62-src.tar.gz=94e9093a19a1ec6c0b3ff531607481ebd8fbaabf215868ddeed9046954fe5883b2c0d436bddb3cab0c0ae40b061aaef866d4baaa8512471836e64fc92f90661b
>
> I have tested this with:
>
> mvn -V -Ddoclint=none -Prelease -Ptest-deploy clean package site deploy
>
> Using:
>
> Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9)
> Maven home: /usr/local/Cellar/maven/3.9.4/libexec
> Java version: 1.8.0_382, vendor: Homebrew, runtime: 
> /usr/local/Cellar/openjdk@8/1.8.0+382/libexec/openjdk.jdk/Contents/Home/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x", version: "13.5.1", arch: "x86_64", family: "mac"
> Darwin  22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 
> 2023; root:xnu-8796.141.3~6/RELEASE_X86_64 x86_64
>
> Details of changes since 61 are in the release notes:
> 
> https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1/RELEASE-NOTES.txt
> 
> https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1/site/changes-report.html
>
> Site:
> 
> https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1/site/index.html
> (note some *relative* links are broken and the 62 directories are not yet 
> created - these will be OK once the site is deployed.)
>
> RAT Report:
> 
> https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1/site/rat-report.html
>
> KEYS:
>   https://downloads.apache.org/commons/KEYS
>
> Please review the release candidate and vote.
> This vote will close no sooner than 72 hours from now.
>
>   [ ] +1 Release these artifacts
>   [ ] +0 OK, but...
>   [ ] -0 OK, but really should fix...
>   [ ] -1 I oppose this release because...
>
> Thank you,
>
> garydgregory,
> Release Manager (using key DEADBEEF)
>
> For following is intended as a helper and refresher for reviewers.
>
> Validating a release candidate
> ==
>
> These guidelines are NOT complete.
>
> Requirements: Git, Java, Maven.
>
> You can validate a release from a release candidate (RC) tag as follows.
>
> 1a) Clone and checkout the RC tag
>
> git clone https://gitbox.apache.org/repos/asf/commons-parent.git --branch 
> commons-parent-62-RC1 commons-parent-62-RC1
> cd commons-parent-62-RC1
>
> 1b) Download and unpack the source archive from:
>
> https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1/source
>
> 2) Check Apache licenses
>
> This step is not required if the site includes a RAT report page which you 
> then must check.
>
> mvn apache-rat:check
>
> 3) Check binary compatibility
>
> Older components still use Apache Clirr:
>
> This step is not required if the site includes a Clirr report page which you 
> then must check.
>
> mvn clirr:check
>
> Newer components use JApiCmp with the japicmp Maven Profile:
>
> This step is not required if the site includes a JApiCmp report page which 
> you then must check.
>
> mvn install -DskipTests -P japicmp japicmp:cmp
>
> 4) Build the package
>
> mvn -V clean package
>
> You can record the Maven and Java version produced by -V in your VOTE reply.
> To gather OS information from a command line:
> Windows: ver
> Linux: uname -a
>
> 5) B

[RESULT][VOTE][LAZY] Release Apache Commons Parent 62 based on RC1

2023-09-05 Thread Gary Gregory
This lazy vote passes with one binding vote from Gary Gregory.

Gary

On Tue, Sep 5, 2023 at 12:32 PM Gary Gregory  wrote:
>
> My +1
>
> Gary
>
> On Sat, Sep 2, 2023 at 10:01 AM Gary Gregory  wrote:
> >
> > We have fixed one bug since Apache Commons Parent 61 was released, so I 
> > would like to release Apache Commons Parent 62.
> >
> > Apache Commons Parent 62 RC1 is available for review here:
> > https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1 
> > (svn revision 63744)
> >
> > The Git tag commons-parent-62-RC1 commit for this RC is 
> > b07ecd5204794c818d0c885c05944c83830b3577 which you can browse here:
> > 
> > https://gitbox.apache.org/repos/asf?p=commons-parent.git;a=commit;h=b07ecd5204794c818d0c885c05944c83830b3577
> > You may checkout this tag using:
> > git clone https://gitbox.apache.org/repos/asf/commons-parent.git 
> > --branch commons-parent-62-RC1 commons-parent-62-RC1
> >
> > Maven artifacts are here:
> > 
> > https://repository.apache.org/content/repositories/orgapachecommons-1653/org/apache/commons/commons-parent/62/
> >
> > These are the artifacts and their hashes:
> >
> > #Release SHA-512s
> > #Sat Sep 02 09:54:14 EDT 2023
> > commons-parent-62-bom.json=ea2fa1f0334cb99dc3a984886c0fbe7369fbb11017ba3e24b0b4541f1b1e45bda64c9cc156f6deb400c290979635ac330e949e75f5d3bd7a7d3c64ca024c
> > commons-parent-62-site.xml=c6aea4f2c03920366bee23b08b046dacc09710e92c78ccd83f47cd92f89bc53abc3b8bbc7f44017ee94a2cb022ce763fe3f7d8c9aa42d571350269ba6568ca07
> > commons-parent-62-bom.xml=a9dd18751162e1e7c737671e179c83c51c180869f40c98fda3a502d61e4f647553ea573fb0e8a7e3625df657ca6e4c94f8ffadd805b37b1d679e6ceeb613c119
> > org.apache.commons_commons-parent-62.spdx.json=b05249edd0d8354c741b4fb2907402a0e31900c6ea1d6d704bd6bb4c6110976d6b49909d7352512a9ebd2129d9e7b5014e9068e87331c5414a07eac1a85c7066
> > commons-parent-62-src.zip=2db114298e6b8bba06103802633ce32a8458a74a0d5e4530e6029f88e26a4f13aafa3f406c701e34f28553a6dea03b271c727d7227dec5feec53a07200f63160
> > commons-parent-62-src.tar.gz=94e9093a19a1ec6c0b3ff531607481ebd8fbaabf215868ddeed9046954fe5883b2c0d436bddb3cab0c0ae40b061aaef866d4baaa8512471836e64fc92f90661b
> >
> > I have tested this with:
> >
> > mvn -V -Ddoclint=none -Prelease -Ptest-deploy clean package site deploy
> >
> > Using:
> >
> > Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9)
> > Maven home: /usr/local/Cellar/maven/3.9.4/libexec
> > Java version: 1.8.0_382, vendor: Homebrew, runtime: 
> > /usr/local/Cellar/openjdk@8/1.8.0+382/libexec/openjdk.jdk/Contents/Home/jre
> > Default locale: en_US, platform encoding: UTF-8
> > OS name: "mac os x", version: "13.5.1", arch: "x86_64", family: "mac"
> > Darwin  22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 
> > 2023; root:xnu-8796.141.3~6/RELEASE_X86_64 x86_64
> >
> > Details of changes since 61 are in the release notes:
> > 
> > https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1/RELEASE-NOTES.txt
> > 
> > https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1/site/changes-report.html
> >
> > Site:
> > 
> > https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1/site/index.html
> > (note some *relative* links are broken and the 62 directories are not 
> > yet created - these will be OK once the site is deployed.)
> >
> > RAT Report:
> > 
> > https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1/site/rat-report.html
> >
> > KEYS:
> >   https://downloads.apache.org/commons/KEYS
> >
> > Please review the release candidate and vote.
> > This vote will close no sooner than 72 hours from now.
> >
> >   [ ] +1 Release these artifacts
> >   [ ] +0 OK, but...
> >   [ ] -0 OK, but really should fix...
> >   [ ] -1 I oppose this release because...
> >
> > Thank you,
> >
> > garydgregory,
> > Release Manager (using key DEADBEEF)
> >
> > For following is intended as a helper and refresher for reviewers.
> >
> > Validating a release candidate
> > ==
> >
> > These guidelines are NOT complete.
> >
> > Requirements: Git, Java, Maven.
> >
> > You can validate a release from a release candidate (RC) tag as follows.
> >
> > 1a) Clone and checkout the RC tag
> >
> > git clone https://gitbox.apache.org/repos/asf/commons-parent.git --branch 
> > commons-parent-62-RC1 commons-parent-62-RC1
> > cd commons-parent-62-RC1
> >
> > 1b) Download and unpack the source archive from:
> >
> > https://dist.apache.org/repos/dist/dev/commons/commons-parent/62-RC1/source
> >
> > 2) Check Apache licenses
> >
> > This step is not required if the site includes a RAT report page which you 
> > then must check.
> >
> > mvn apache-rat:check
> >
> > 3) Check binary compatibility
> >
> > Older components still use Apache Clirr:
> >
> > This step is not required if the site includes a Clirr report page which 
> > you then must check.
> >
> > mvn clirr:check
> >
> > Newer components use JApiCmp with the japicmp Maven Profile:
> >
> > T