Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AC515200BD8 for ; Tue, 22 Nov 2016 16:59:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id AB26A160B1E; Tue, 22 Nov 2016 15:59:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F3113160B0C for ; Tue, 22 Nov 2016 16:59:00 +0100 (CET) Received: (qmail 56181 invoked by uid 500); 22 Nov 2016 15:59:00 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 56095 invoked by uid 99); 22 Nov 2016 15:58:59 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Nov 2016 15:58:59 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id D981F2C2B10 for ; Tue, 22 Nov 2016 15:58:59 +0000 (UTC) Date: Tue, 22 Nov 2016 15:58:59 +0000 (UTC) From: "Richard Wheeldon (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CSV-203) withNullString value is printed without quotes when QuoteMode.ALL is specified MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 22 Nov 2016 15:59:01 -0000 [ https://issues.apache.org/jira/browse/CSV-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Richard Wheeldon updated CSV-203: --------------------------------- Affects Version/s: 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)