Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AACBFDEF2 for ; Sun, 14 Oct 2012 23:23:04 +0000 (UTC) Received: (qmail 94197 invoked by uid 500); 14 Oct 2012 23:23:04 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 94138 invoked by uid 500); 14 Oct 2012 23:23:04 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 94131 invoked by uid 99); 14 Oct 2012 23:23:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Oct 2012 23:23:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Oct 2012 23:23:02 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3569A238899C for ; Sun, 14 Oct 2012 23:22:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1398148 - in /commons/proper/csv/trunk/src: main/java/org/apache/commons/csv/CSVFormat.java test/java/org/apache/commons/csv/CSVFormatTest.java Date: Sun, 14 Oct 2012 23:22:18 -0000 To: commits@commons.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121014232218.3569A238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ggregory Date: Sun Oct 14 23:22:17 2012 New Revision: 1398148 URL: http://svn.apache.org/viewvc?rev=1398148&view=rev Log: Validation fails if no quotes mode set but no escape character is set. Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1398148&r1=1398147&r2=1398148&view=diff ============================================================================== --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Sun Oct 14 23:22:17 2012 @@ -199,6 +199,10 @@ public class CSVFormat implements Serial if (escape != null && escape == commentStart) { throw new IllegalStateException("The comment start and the escape character cannot be the same ('" + commentStart + "')"); } + + if (escape == null && quotePolicy == Quote.NONE) { + throw new IllegalStateException("No quotes mode set but no escape character is set"); + } } /** Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java?rev=1398148&r1=1398147&r2=1398148&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java Sun Oct 14 23:22:17 2012 @@ -153,7 +153,14 @@ public class CSVFormatTest { } catch (final IllegalStateException e) { // expected } - } + + try { + format.withQuoteChar('!').withQuotePolicy(Quote.NONE).validate(); + fail(); + } catch (final IllegalStateException e) { + // expected + } +} @SuppressWarnings("boxing") // no need to worry about boxing here @Test