Skip to content

Commit a50d473

Browse files
committed
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
1 parent f074aee commit a50d473

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/org/apache/commons/csv/CSVFormat.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ private static boolean isLineBreak(final Character c) {
173173
* @throws IllegalStateException
174174
*/
175175
void validate() throws IllegalStateException {
176-
if (delimiter == encapsulator) {
176+
if (encapsulator != null && delimiter == encapsulator) {
177177
throw new IllegalStateException("The encapsulator character and the delimiter cannot be the same ('" + encapsulator + "')");
178178
}
179179

180-
if (delimiter == escape) {
180+
if (escape != null && delimiter == escape) {
181181
throw new IllegalStateException("The escape character and the delimiter cannot be the same ('" + escape + "')");
182182
}
183183

184-
if (delimiter == commentStart) {
184+
if (commentStart != null && delimiter == commentStart) {
185185
throw new IllegalStateException("The comment start character and the delimiter cannot be the same ('" + commentStart +
186186
"')");
187187
}

0 commit comments

Comments
 (0)