Skip to content

Commit f074aee

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@1397927 13f79535-47bb-0310-9956-ffa450edef68
1 parent df59276 commit f074aee

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class CSVFormat implements Serializable {
3939

4040
private static final long serialVersionUID = 1L;
4141

42-
private final Character delimiter;
42+
private final char delimiter;
4343
private final Character encapsulator;
4444
private final Character commentStart;
4545
private final Character escape;
@@ -49,9 +49,9 @@ public class CSVFormat implements Serializable {
4949
private final String[] header;
5050

5151
/**
52-
* Starting format with no settings defined; used for creating other formats from scratch.
52+
* Starting format; used for creating other formats.
5353
*/
54-
static final CSVFormat PRISTINE = new CSVFormat(null, null, null, null, false, false, null, null);
54+
static final CSVFormat PRISTINE = new CSVFormat(COMMA, null, null, null, false, false, null, null);
5555

5656
/**
5757
* Standard comma separated format, as for {@link #RFC4180} but allowing blank lines.
@@ -143,7 +143,7 @@ public class CSVFormat implements Serializable {
143143
* @param header
144144
* the header
145145
*/
146-
public CSVFormat(final Character delimiter, final Character encapsulator, final Character commentStart, final Character escape, final
146+
public CSVFormat(final char delimiter, final Character encapsulator, final Character commentStart, final Character escape, final
147147
boolean ignoreSurroundingSpaces, final boolean ignoreEmptyLines, final String lineSeparator, final String[] header) {
148148
this.delimiter = delimiter;
149149
this.encapsulator = encapsulator;
@@ -173,10 +173,6 @@ private static boolean isLineBreak(final Character c) {
173173
* @throws IllegalStateException
174174
*/
175175
void validate() throws IllegalStateException {
176-
if (delimiter == null) {
177-
throw new IllegalStateException("The delimiter character cannot be null");
178-
}
179-
180176
if (delimiter == encapsulator) {
181177
throw new IllegalStateException("The encapsulator character and the delimiter cannot be the same ('" + encapsulator + "')");
182178
}

0 commit comments

Comments
 (0)