From a50d473a3bd44b84281a5d94432bf7e812472b68 Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Sat, 13 Oct 2012 19:15:59 +0000 Subject: [PATCH] Delimiter is not optional so change back type from Character to char. The side effect is that the "pristine" format must be built with somekind of default (',') seems reasonable. The comment used to say "no settings defined" but that was not true, since false was passed in for two values instead of null. IMO, this is all due to the fluent API making this part of the code a little more tricky. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1397930 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/java/org/apache/commons/csv/CSVFormat.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java index 29f9e621..1cecbe75 100644 --- a/src/main/java/org/apache/commons/csv/CSVFormat.java +++ b/src/main/java/org/apache/commons/csv/CSVFormat.java @@ -173,15 +173,15 @@ public class CSVFormat implements Serializable { * @throws IllegalStateException */ void validate() throws IllegalStateException { - if (delimiter == encapsulator) { + if (encapsulator != null && delimiter == encapsulator) { throw new IllegalStateException("The encapsulator character and the delimiter cannot be the same ('" + encapsulator + "')"); } - if (delimiter == escape) { + if (escape != null && delimiter == escape) { throw new IllegalStateException("The escape character and the delimiter cannot be the same ('" + escape + "')"); } - if (delimiter == commentStart) { + if (commentStart != null && delimiter == commentStart) { throw new IllegalStateException("The comment start character and the delimiter cannot be the same ('" + commentStart + "')"); }