commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "tim hood (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CSV-63) CSVPrinter always quotes empty string if it is the first on a line
Date Tue, 21 Jul 2015 20:15:04 GMT

    [ https://issues.apache.org/jira/browse/CSV-63?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14635731#comment-14635731
] 

tim hood edited comment on CSV-63 at 7/21/15 8:14 PM:
------------------------------------------------------

This seems to work or have I got the wrong idea.

{code:java}
    @SuppressWarnings("static-method")
    @Test
    public void test()
    {
        try
        {
            final CSVFormat format = CSVFormat.DEFAULT.withEscape('\\').withQuoteMode(QuoteMode.NONE);

            final StringWriter out = new StringWriter();

            try (CSVPrinter printer = new CSVPrinter(out, format))
            {
                printer.printRecord(Arrays.asList(new String[] { "", "", "" }));
            }

            final String result = out.toString().trim();
            System.out.println(">>" + result + "<<");

            Assert.assertEquals(2, result.length());
        }
        catch (final IOException e)
        {
            Assert.fail(e.getMessage());
        }
    }
{code}



was (Author: timz):
This seems to work or have I got the wrong idea.

```java
    @SuppressWarnings("static-method")
    @Test
    public void test()
    {
        try
        {
            final CSVFormat format = CSVFormat.DEFAULT.withEscape('\\').withQuoteMode(QuoteMode.NONE);

            final StringWriter out = new StringWriter();

            try (CSVPrinter printer = new CSVPrinter(out, format))
            {
                printer.printRecord(Arrays.asList(new String[] { "", "", "" }));
            }

            final String result = out.toString().trim();
            System.out.println(">>" + result + "<<");

            Assert.assertEquals(2, result.length());
        }
        catch (final IOException e)
        {
            Assert.fail(e.getMessage());
        }
    }
```


> CSVPrinter always quotes empty string if it is the first on a line
> ------------------------------------------------------------------
>
>                 Key: CSV-63
>                 URL: https://issues.apache.org/jira/browse/CSV-63
>             Project: Commons CSV
>          Issue Type: Improvement
>          Components: Printer
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: Patch Needed, 1.x
>
>
> CSVPrinter always quotes the empty string if it is the first on a line.
> This is inconsistent.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message