Skip to content

Commit e33bede

Browse files
committed
Change back to DEFAULT format name.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1461192 13f79535-47bb-0310-9956-ffa450edef68
1 parent 1e83d1f commit e33bede

8 files changed

Lines changed: 37 additions & 37 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public class CSVFormat implements Serializable {
8484
* <li>withIgnoreEmptyLines(true)</li>
8585
* </ul>
8686
*/
87-
public static final CSVFormat RFC4180_EMPTY_LINES =
87+
public static final CSVFormat DEFAULT =
8888
newBuilder()
8989
.build();
9090

@@ -166,7 +166,7 @@ public static CSVFormatBuilder newBuilder(final CSVFormat format) {
166166
* <li>withLineSeparator(CRLF)</li>
167167
* </ul>
168168
*
169-
* Shortcut for {@code CSVFormat.newBuilder(CSVFormat.RFC4180_EMPTY_LINES)}
169+
* Shortcut for {@code CSVFormat.newBuilder(CSVFormat.DEFAULT)}
170170
*
171171
* @return a standard comma separated format builder, as for {@link #RFC4180} but allowing empty lines.
172172
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public class CSVParser implements Iterable<CSVRecord> {
8989
* thrown if the parameters of the format are inconsistent
9090
*/
9191
public CSVParser(final Reader input) throws IOException {
92-
this(input, CSVFormat.RFC4180_EMPTY_LINES);
92+
this(input, CSVFormat.DEFAULT);
9393
}
9494

9595
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ public class CSVPrinter implements Flushable, Closeable {
5252
* @param out
5353
* stream to which to print.
5454
* @param format
55-
* the CSV format. If null the default format is used ({@link CSVFormat#RFC4180_EMPTY_LINES})
55+
* the CSV format. If null the default format is used ({@link CSVFormat#DEFAULT})
5656
* @throws IllegalArgumentException
5757
* thrown if the parameters of the format are inconsistent
5858
*/
5959
public CSVPrinter(final Appendable out, final CSVFormat format) {
6060
this.out = out;
61-
this.format = format == null ? CSVFormat.RFC4180_EMPTY_LINES : format;
61+
this.format = format == null ? CSVFormat.DEFAULT : format;
6262
}
6363

6464
// ======================================================

src/main/java/org/apache/commons/csv/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
* <p>Example usage:</p>
6969
* <blockquote><pre>
7070
* Reader in = new StringReader("a,b,c");
71-
* for (CSVRecord record : CSVFormat.RFC4180_EMPTY_LINES.parse(in)) {
71+
* for (CSVRecord record : CSVFormat.DEFAULT.parse(in)) {
7272
* for (String field : record) {
7373
* System.out.print("\"" + field + "\", ");
7474
* }

src/test/java/org/apache/commons/csv/CSVFormatTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class CSVFormatTest {
3737

3838
@Test
3939
public void testFormat() {
40-
final CSVFormat format = CSVFormat.RFC4180_EMPTY_LINES;
40+
final CSVFormat format = CSVFormat.DEFAULT;
4141

4242
assertEquals("", format.format());
4343
assertEquals("a,b,c", format.format("a", "b", "c"));
@@ -50,26 +50,26 @@ public void testSerialization() throws Exception {
5050
final ByteArrayOutputStream out = new ByteArrayOutputStream();
5151

5252
final ObjectOutputStream oos = new ObjectOutputStream(out);
53-
oos.writeObject(CSVFormat.RFC4180_EMPTY_LINES);
53+
oos.writeObject(CSVFormat.DEFAULT);
5454
oos.flush();
5555
oos.close();
5656

5757
final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(out.toByteArray()));
5858
final CSVFormat format = (CSVFormat) in.readObject();
5959

6060
assertNotNull(format);
61-
assertEquals("delimiter", CSVFormat.RFC4180_EMPTY_LINES.getDelimiter(), format.getDelimiter());
62-
assertEquals("encapsulator", CSVFormat.RFC4180_EMPTY_LINES.getQuoteChar(), format.getQuoteChar());
63-
assertEquals("comment start", CSVFormat.RFC4180_EMPTY_LINES.getCommentStart(), format.getCommentStart());
64-
assertEquals("line separator", CSVFormat.RFC4180_EMPTY_LINES.getRecordSeparator(), format.getRecordSeparator());
65-
assertEquals("escape", CSVFormat.RFC4180_EMPTY_LINES.getEscape(), format.getEscape());
66-
assertEquals("trim", CSVFormat.RFC4180_EMPTY_LINES.getIgnoreSurroundingSpaces(), format.getIgnoreSurroundingSpaces());
67-
assertEquals("empty lines", CSVFormat.RFC4180_EMPTY_LINES.getIgnoreEmptyLines(), format.getIgnoreEmptyLines());
61+
assertEquals("delimiter", CSVFormat.DEFAULT.getDelimiter(), format.getDelimiter());
62+
assertEquals("encapsulator", CSVFormat.DEFAULT.getQuoteChar(), format.getQuoteChar());
63+
assertEquals("comment start", CSVFormat.DEFAULT.getCommentStart(), format.getCommentStart());
64+
assertEquals("line separator", CSVFormat.DEFAULT.getRecordSeparator(), format.getRecordSeparator());
65+
assertEquals("escape", CSVFormat.DEFAULT.getEscape(), format.getEscape());
66+
assertEquals("trim", CSVFormat.DEFAULT.getIgnoreSurroundingSpaces(), format.getIgnoreSurroundingSpaces());
67+
assertEquals("empty lines", CSVFormat.DEFAULT.getIgnoreEmptyLines(), format.getIgnoreEmptyLines());
6868
}
6969

7070
@Test
7171
public void testEquals() {
72-
final CSVFormat right = CSVFormat.RFC4180_EMPTY_LINES;
72+
final CSVFormat right = CSVFormat.DEFAULT;
7373
final CSVFormat left = CSVFormat.newBuilder().build();
7474

7575
assertFalse(right.equals(null));

src/test/java/org/apache/commons/csv/CSVLexerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public void testNextToken3() throws IOException {
178178
* \,,
179179
*/
180180
final String code = "a,\\,,b\\\n\\,,";
181-
final CSVFormat format = CSVFormat.RFC4180_EMPTY_LINES;
181+
final CSVFormat format = CSVFormat.DEFAULT;
182182
assertFalse(format.isEscaping());
183183
final Lexer parser = getLexer(code, format);
184184

@@ -242,7 +242,7 @@ public void testNextToken4() throws IOException {
242242
@Test
243243
public void testNextToken5() throws IOException {
244244
final String code = "a,\"foo\n\",b\n\"foo\n baar ,,,\"\n\"\n\t \n\"";
245-
final Lexer parser = getLexer(code, CSVFormat.RFC4180_EMPTY_LINES);
245+
final Lexer parser = getLexer(code, CSVFormat.DEFAULT);
246246
assertTokenEquals(TOKEN, "a", parser.nextToken(new Token()));
247247
assertTokenEquals(TOKEN, "foo\n", parser.nextToken(new Token()));
248248
assertTokenEquals(EORECORD, "b", parser.nextToken(new Token()));

src/test/java/org/apache/commons/csv/CSVParserTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,13 @@ public void testEmptyLineBehaviourCSV() throws Exception {
234234

235235
@Test
236236
public void testEmptyFile() throws Exception {
237-
final CSVParser parser = new CSVParser("", CSVFormat.RFC4180_EMPTY_LINES);
237+
final CSVParser parser = new CSVParser("", CSVFormat.DEFAULT);
238238
assertNull(parser.nextRecord());
239239
}
240240

241241
@Test
242242
public void testCSV57() throws Exception {
243-
final CSVParser parser = new CSVParser("", CSVFormat.RFC4180_EMPTY_LINES);
243+
final CSVParser parser = new CSVParser("", CSVFormat.DEFAULT);
244244
final List<CSVRecord> list = parser.getRecords();
245245
assertNotNull(list);
246246
assertEquals(0, list.size());
@@ -366,7 +366,7 @@ public void testDefaultFormat() throws IOException {
366366
{"# Final comment"}
367367
};
368368

369-
CSVFormat format = CSVFormat.RFC4180_EMPTY_LINES;
369+
CSVFormat format = CSVFormat.DEFAULT;
370370
assertFalse(format.isCommentingEnabled());
371371

372372
CSVParser parser = new CSVParser(code, format);
@@ -427,7 +427,7 @@ public void testForEach() throws Exception {
427427

428428
final Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");
429429

430-
for (final CSVRecord record : CSVFormat.RFC4180_EMPTY_LINES.parse(in)) {
430+
for (final CSVRecord record : CSVFormat.DEFAULT.parse(in)) {
431431
records.add(record);
432432
}
433433

@@ -440,9 +440,9 @@ public void testForEach() throws Exception {
440440
@Test
441441
public void testRoundtrip() throws Exception {
442442
final StringWriter out = new StringWriter();
443-
final CSVPrinter printer = new CSVPrinter(out, CSVFormat.RFC4180_EMPTY_LINES);
443+
final CSVPrinter printer = new CSVPrinter(out, CSVFormat.DEFAULT);
444444
final String input = "a,b,c\r\n1,2,3\r\nx,y,z\r\n";
445-
for (final CSVRecord record : CSVFormat.RFC4180_EMPTY_LINES.parse(new StringReader(input))) {
445+
for (final CSVRecord record : CSVFormat.DEFAULT.parse(new StringReader(input))) {
446446
printer.printRecord(record);
447447
}
448448
assertEquals(input, out.toString());
@@ -453,7 +453,7 @@ public void testRoundtrip() throws Exception {
453453
public void testIterator() throws Exception {
454454
final Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");
455455

456-
final Iterator<CSVRecord> iterator = CSVFormat.RFC4180_EMPTY_LINES.parse(in).iterator();
456+
final Iterator<CSVRecord> iterator = CSVFormat.DEFAULT.parse(in).iterator();
457457

458458
assertTrue(iterator.hasNext());
459459
try {

src/test/java/org/apache/commons/csv/CSVPrinterTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static String printable(final String s) {
5151
return sb.toString();
5252
}
5353

54-
String recordSeparator = CSVFormat.RFC4180_EMPTY_LINES.getRecordSeparator();
54+
String recordSeparator = CSVFormat.DEFAULT.getRecordSeparator();
5555

5656
public void doOneRandom(final CSVFormat format) throws Exception {
5757
final Random r = new Random();
@@ -144,7 +144,7 @@ public String randStr() {
144144
@Test
145145
public void testDisabledComment() throws IOException {
146146
final StringWriter sw = new StringWriter();
147-
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES);
147+
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
148148
printer.printComment("This is a comment");
149149

150150
assertEquals("", sw.toString());
@@ -216,7 +216,7 @@ public void testJdbcPrinter() throws IOException, ClassNotFoundException, SQLExc
216216
stmt.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");
217217
stmt.execute("insert into TEST values(1, 'r1')");
218218
stmt.execute("insert into TEST values(2, 'r2')");
219-
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES);
219+
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
220220
printer.printRecords(stmt.executeQuery("select ID, NAME from TEST"));
221221
assertEquals("1,r1" + recordSeparator + "2,r2" + recordSeparator, sw.toString());
222222
printer.close();
@@ -238,7 +238,7 @@ public void testMultiLineComment() throws IOException {
238238
@Test
239239
public void testPrinter1() throws IOException {
240240
final StringWriter sw = new StringWriter();
241-
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES);
241+
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
242242
printer.printRecord("a", "b");
243243
assertEquals("a,b" + recordSeparator, sw.toString());
244244
printer.close();
@@ -247,7 +247,7 @@ public void testPrinter1() throws IOException {
247247
@Test
248248
public void testPrinter2() throws IOException {
249249
final StringWriter sw = new StringWriter();
250-
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES);
250+
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
251251
printer.printRecord("a,b", "b");
252252
assertEquals("\"a,b\",b" + recordSeparator, sw.toString());
253253
printer.close();
@@ -256,7 +256,7 @@ public void testPrinter2() throws IOException {
256256
@Test
257257
public void testPrinter3() throws IOException {
258258
final StringWriter sw = new StringWriter();
259-
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES);
259+
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
260260
printer.printRecord("a, b", "b ");
261261
assertEquals("\"a, b\",\"b \"" + recordSeparator, sw.toString());
262262
printer.close();
@@ -265,7 +265,7 @@ public void testPrinter3() throws IOException {
265265
@Test
266266
public void testPrinter4() throws IOException {
267267
final StringWriter sw = new StringWriter();
268-
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES);
268+
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
269269
printer.printRecord("a", "b\"c");
270270
assertEquals("a,\"b\"\"c\"" + recordSeparator, sw.toString());
271271
printer.close();
@@ -274,7 +274,7 @@ public void testPrinter4() throws IOException {
274274
@Test
275275
public void testPrinter5() throws IOException {
276276
final StringWriter sw = new StringWriter();
277-
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES);
277+
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
278278
printer.printRecord("a", "b\nc");
279279
assertEquals("a,\"b\nc\"" + recordSeparator, sw.toString());
280280
printer.close();
@@ -283,7 +283,7 @@ public void testPrinter5() throws IOException {
283283
@Test
284284
public void testPrinter6() throws IOException {
285285
final StringWriter sw = new StringWriter();
286-
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES);
286+
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
287287
printer.printRecord("a", "b\r\nc");
288288
assertEquals("a,\"b\r\nc\"" + recordSeparator, sw.toString());
289289
printer.close();
@@ -292,7 +292,7 @@ public void testPrinter6() throws IOException {
292292
@Test
293293
public void testPrinter7() throws IOException {
294294
final StringWriter sw = new StringWriter();
295-
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES);
295+
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
296296
printer.printRecord("a", "b\\c");
297297
assertEquals("a,b\\c" + recordSeparator, sw.toString());
298298
printer.close();
@@ -301,7 +301,7 @@ public void testPrinter7() throws IOException {
301301
@Test
302302
public void testPrintNullValues() throws IOException {
303303
final StringWriter sw = new StringWriter();
304-
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES);
304+
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
305305
printer.printRecord("a", null, "b");
306306
assertEquals("a,,b" + recordSeparator, sw.toString());
307307
printer.close();
@@ -328,7 +328,7 @@ public void testQuoteNonNumeric() throws IOException {
328328
@Test
329329
public void testRandom() throws Exception {
330330
final int iter = 10000;
331-
doRandom(CSVFormat.RFC4180_EMPTY_LINES, iter);
331+
doRandom(CSVFormat.DEFAULT, iter);
332332
doRandom(CSVFormat.EXCEL, iter);
333333
doRandom(CSVFormat.MYSQL, iter);
334334
}

0 commit comments

Comments
 (0)