You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Richard Wheeldon (JIRA)" <ji...@apache.org> on 2016/11/22 15:58:59 UTC

[jira] [Commented] (CSV-203) withNullString value is printed without quotes when QuoteMode.ALL is specified

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

Richard Wheeldon commented on CSV-203:
--------------------------------------

Also broken in 1.3


> withNullString value is printed without quotes when QuoteMode.ALL is specified
> ------------------------------------------------------------------------------
>
>                 Key: CSV-203
>                 URL: https://issues.apache.org/jira/browse/CSV-203
>             Project: Commons CSV
>          Issue Type: Bug
>          Components: Printer
>    Affects Versions: 1.3, 1.4
>            Reporter: Richard Wheeldon
>              Labels: regression
>
> When setting QuoteMode.ALL is set we expect all values to be quoted, even those set as a default. This works in Commons 1.2 but doesn't in 1.4.
> Consider the following program:
> {code}
> import org.apache.commons.csv.QuoteMode;
> import org.apache.commons.csv.CSVFormat;
> import org.apache.commons.csv.CSVPrinter;
> public class CommonsCsvIsSlightlyBroken {
>     
>     public static void main(String[] args) throws Exception {
>         CSVFormat format = CSVFormat.EXCEL
>             .withNullString("N/A")
>             .withIgnoreSurroundingSpaces(true)
>             .withQuoteMode(QuoteMode.ALL);
>         CSVPrinter printer = new CSVPrinter(System.out, format);
>         printer.printRecord(new Object[] { null, "Hello", null, "World" });
>     }
> }
> {code}
> For 1.2 we get quoted output:
> {code}
> richard@kichemaru:~/$ java -cp ~/.m2/repository/org/apache/commons/commons-csv/1.2/commons-csv-1.2.jar:. CommonsCsvIsSlightlyBroken
> "N/A","Hello","N/A","World"
> {code}
> When run with 1.4 we get unquoted output for default fields:
> {code}
> richard@kichemaru:~/$ java -cp ~/.m2/repository/org/apache/commons/commons-csv/1.4/commons-csv-1.4.jar:. CommonsCsvIsSlightlyBroken
> N/A,"Hello",N/A,"World"
> {code}



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