commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1397930 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
Date Sat, 13 Oct 2012 19:15:59 GMT
Author: ggregory
Date: Sat Oct 13 19:15:59 2012
New Revision: 1397930

URL: http://svn.apache.org/viewvc?rev=1397930&view=rev
Log:
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.

Modified:
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.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=1397930&r1=1397929&r2=1397930&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 Sat Oct 13
19:15:59 2012
@@ -173,15 +173,15 @@ public class CSVFormat implements Serial
      * @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 + 
                     "')");
         }



Mime
View raw message