Author: ggregory Date: Tue Mar 26 15:50:18 2013 New Revision: 1461192 URL: http://svn.apache.org/r1461192 Log: Change back to DEFAULT format name.
Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/package-info.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.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=1461192&r1=1461191&r2=1461192&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 Tue Mar 26 15:50:18 2013 @@ -84,7 +84,7 @@ public class CSVFormat implements Serial * <li>withIgnoreEmptyLines(true)</li> * </ul> */ - public static final CSVFormat RFC4180_EMPTY_LINES = + public static final CSVFormat DEFAULT = newBuilder() .build(); @@ -166,7 +166,7 @@ public class CSVFormat implements Serial * <li>withLineSeparator(CRLF)</li> * </ul> * - * Shortcut for {@code CSVFormat.newBuilder(CSVFormat.RFC4180_EMPTY_LINES)} + * Shortcut for {@code CSVFormat.newBuilder(CSVFormat.DEFAULT)} * * @return a standard comma separated format builder, as for {@link #RFC4180} but allowing empty lines. */ Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1461192&r1=1461191&r2=1461192&view=diff ============================================================================== --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Tue Mar 26 15:50:18 2013 @@ -89,7 +89,7 @@ public class CSVParser implements Iterab * thrown if the parameters of the format are inconsistent */ public CSVParser(final Reader input) throws IOException { - this(input, CSVFormat.RFC4180_EMPTY_LINES); + this(input, CSVFormat.DEFAULT); } /** Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java?rev=1461192&r1=1461191&r2=1461192&view=diff ============================================================================== --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java Tue Mar 26 15:50:18 2013 @@ -52,13 +52,13 @@ public class CSVPrinter implements Flush * @param out * stream to which to print. * @param format - * the CSV format. If null the default format is used ({@link CSVFormat#RFC4180_EMPTY_LINES}) + * the CSV format. If null the default format is used ({@link CSVFormat#DEFAULT}) * @throws IllegalArgumentException * thrown if the parameters of the format are inconsistent */ public CSVPrinter(final Appendable out, final CSVFormat format) { this.out = out; - this.format = format == null ? CSVFormat.RFC4180_EMPTY_LINES : format; + this.format = format == null ? CSVFormat.DEFAULT : format; } // ====================================================== Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/package-info.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/package-info.java?rev=1461192&r1=1461191&r2=1461192&view=diff ============================================================================== --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/package-info.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/package-info.java Tue Mar 26 15:50:18 2013 @@ -68,7 +68,7 @@ * <p>Example usage:</p> * <blockquote><pre> * Reader in = new StringReader("a,b,c"); - * for (CSVRecord record : CSVFormat.RFC4180_EMPTY_LINES.parse(in)) { + * for (CSVRecord record : CSVFormat.DEFAULT.parse(in)) { * for (String field : record) { * System.out.print("\"" + field + "\", "); * } Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java?rev=1461192&r1=1461191&r2=1461192&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java Tue Mar 26 15:50:18 2013 @@ -37,7 +37,7 @@ public class CSVFormatTest { @Test public void testFormat() { - final CSVFormat format = CSVFormat.RFC4180_EMPTY_LINES; + final CSVFormat format = CSVFormat.DEFAULT; assertEquals("", format.format()); assertEquals("a,b,c", format.format("a", "b", "c")); @@ -50,7 +50,7 @@ public class CSVFormatTest { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final ObjectOutputStream oos = new ObjectOutputStream(out); - oos.writeObject(CSVFormat.RFC4180_EMPTY_LINES); + oos.writeObject(CSVFormat.DEFAULT); oos.flush(); oos.close(); @@ -58,18 +58,18 @@ public class CSVFormatTest { final CSVFormat format = (CSVFormat) in.readObject(); assertNotNull(format); - assertEquals("delimiter", CSVFormat.RFC4180_EMPTY_LINES.getDelimiter(), format.getDelimiter()); - assertEquals("encapsulator", CSVFormat.RFC4180_EMPTY_LINES.getQuoteChar(), format.getQuoteChar()); - assertEquals("comment start", CSVFormat.RFC4180_EMPTY_LINES.getCommentStart(), format.getCommentStart()); - assertEquals("line separator", CSVFormat.RFC4180_EMPTY_LINES.getRecordSeparator(), format.getRecordSeparator()); - assertEquals("escape", CSVFormat.RFC4180_EMPTY_LINES.getEscape(), format.getEscape()); - assertEquals("trim", CSVFormat.RFC4180_EMPTY_LINES.getIgnoreSurroundingSpaces(), format.getIgnoreSurroundingSpaces()); - assertEquals("empty lines", CSVFormat.RFC4180_EMPTY_LINES.getIgnoreEmptyLines(), format.getIgnoreEmptyLines()); + assertEquals("delimiter", CSVFormat.DEFAULT.getDelimiter(), format.getDelimiter()); + assertEquals("encapsulator", CSVFormat.DEFAULT.getQuoteChar(), format.getQuoteChar()); + assertEquals("comment start", CSVFormat.DEFAULT.getCommentStart(), format.getCommentStart()); + assertEquals("line separator", CSVFormat.DEFAULT.getRecordSeparator(), format.getRecordSeparator()); + assertEquals("escape", CSVFormat.DEFAULT.getEscape(), format.getEscape()); + assertEquals("trim", CSVFormat.DEFAULT.getIgnoreSurroundingSpaces(), format.getIgnoreSurroundingSpaces()); + assertEquals("empty lines", CSVFormat.DEFAULT.getIgnoreEmptyLines(), format.getIgnoreEmptyLines()); } @Test public void testEquals() { - final CSVFormat right = CSVFormat.RFC4180_EMPTY_LINES; + final CSVFormat right = CSVFormat.DEFAULT; final CSVFormat left = CSVFormat.newBuilder().build(); assertFalse(right.equals(null)); Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java?rev=1461192&r1=1461191&r2=1461192&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java Tue Mar 26 15:50:18 2013 @@ -178,7 +178,7 @@ public class CSVLexerTest { * \,, */ final String code = "a,\\,,b\\\n\\,,"; - final CSVFormat format = CSVFormat.RFC4180_EMPTY_LINES; + final CSVFormat format = CSVFormat.DEFAULT; assertFalse(format.isEscaping()); final Lexer parser = getLexer(code, format); @@ -242,7 +242,7 @@ public class CSVLexerTest { @Test public void testNextToken5() throws IOException { final String code = "a,\"foo\n\",b\n\"foo\n baar ,,,\"\n\"\n\t \n\""; - final Lexer parser = getLexer(code, CSVFormat.RFC4180_EMPTY_LINES); + final Lexer parser = getLexer(code, CSVFormat.DEFAULT); assertTokenEquals(TOKEN, "a", parser.nextToken(new Token())); assertTokenEquals(TOKEN, "foo\n", parser.nextToken(new Token())); assertTokenEquals(EORECORD, "b", parser.nextToken(new Token())); Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1461192&r1=1461191&r2=1461192&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Tue Mar 26 15:50:18 2013 @@ -234,13 +234,13 @@ public class CSVParserTest { @Test public void testEmptyFile() throws Exception { - final CSVParser parser = new CSVParser("", CSVFormat.RFC4180_EMPTY_LINES); + final CSVParser parser = new CSVParser("", CSVFormat.DEFAULT); assertNull(parser.nextRecord()); } @Test public void testCSV57() throws Exception { - final CSVParser parser = new CSVParser("", CSVFormat.RFC4180_EMPTY_LINES); + final CSVParser parser = new CSVParser("", CSVFormat.DEFAULT); final List<CSVRecord> list = parser.getRecords(); assertNotNull(list); assertEquals(0, list.size()); @@ -366,7 +366,7 @@ public class CSVParserTest { {"# Final comment"} }; - CSVFormat format = CSVFormat.RFC4180_EMPTY_LINES; + CSVFormat format = CSVFormat.DEFAULT; assertFalse(format.isCommentingEnabled()); CSVParser parser = new CSVParser(code, format); @@ -427,7 +427,7 @@ public class CSVParserTest { final Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z"); - for (final CSVRecord record : CSVFormat.RFC4180_EMPTY_LINES.parse(in)) { + for (final CSVRecord record : CSVFormat.DEFAULT.parse(in)) { records.add(record); } @@ -440,9 +440,9 @@ public class CSVParserTest { @Test public void testRoundtrip() throws Exception { final StringWriter out = new StringWriter(); - final CSVPrinter printer = new CSVPrinter(out, CSVFormat.RFC4180_EMPTY_LINES); + final CSVPrinter printer = new CSVPrinter(out, CSVFormat.DEFAULT); final String input = "a,b,c\r\n1,2,3\r\nx,y,z\r\n"; - for (final CSVRecord record : CSVFormat.RFC4180_EMPTY_LINES.parse(new StringReader(input))) { + for (final CSVRecord record : CSVFormat.DEFAULT.parse(new StringReader(input))) { printer.printRecord(record); } assertEquals(input, out.toString()); @@ -453,7 +453,7 @@ public class CSVParserTest { public void testIterator() throws Exception { final Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z"); - final Iterator<CSVRecord> iterator = CSVFormat.RFC4180_EMPTY_LINES.parse(in).iterator(); + final Iterator<CSVRecord> iterator = CSVFormat.DEFAULT.parse(in).iterator(); assertTrue(iterator.hasNext()); try { Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1461192&r1=1461191&r2=1461192&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Tue Mar 26 15:50:18 2013 @@ -51,7 +51,7 @@ public class CSVPrinterTest { return sb.toString(); } - String recordSeparator = CSVFormat.RFC4180_EMPTY_LINES.getRecordSeparator(); + String recordSeparator = CSVFormat.DEFAULT.getRecordSeparator(); public void doOneRandom(final CSVFormat format) throws Exception { final Random r = new Random(); @@ -144,7 +144,7 @@ public class CSVPrinterTest { @Test public void testDisabledComment() throws IOException { final StringWriter sw = new StringWriter(); - final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES); + final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printComment("This is a comment"); assertEquals("", sw.toString()); @@ -216,7 +216,7 @@ public class CSVPrinterTest { stmt.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"); stmt.execute("insert into TEST values(1, 'r1')"); stmt.execute("insert into TEST values(2, 'r2')"); - final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES); + final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecords(stmt.executeQuery("select ID, NAME from TEST")); assertEquals("1,r1" + recordSeparator + "2,r2" + recordSeparator, sw.toString()); printer.close(); @@ -238,7 +238,7 @@ public class CSVPrinterTest { @Test public void testPrinter1() throws IOException { final StringWriter sw = new StringWriter(); - final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES); + final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b"); assertEquals("a,b" + recordSeparator, sw.toString()); printer.close(); @@ -247,7 +247,7 @@ public class CSVPrinterTest { @Test public void testPrinter2() throws IOException { final StringWriter sw = new StringWriter(); - final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES); + final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a,b", "b"); assertEquals("\"a,b\",b" + recordSeparator, sw.toString()); printer.close(); @@ -256,7 +256,7 @@ public class CSVPrinterTest { @Test public void testPrinter3() throws IOException { final StringWriter sw = new StringWriter(); - final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES); + final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a, b", "b "); assertEquals("\"a, b\",\"b \"" + recordSeparator, sw.toString()); printer.close(); @@ -265,7 +265,7 @@ public class CSVPrinterTest { @Test public void testPrinter4() throws IOException { final StringWriter sw = new StringWriter(); - final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES); + final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b\"c"); assertEquals("a,\"b\"\"c\"" + recordSeparator, sw.toString()); printer.close(); @@ -274,7 +274,7 @@ public class CSVPrinterTest { @Test public void testPrinter5() throws IOException { final StringWriter sw = new StringWriter(); - final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES); + final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b\nc"); assertEquals("a,\"b\nc\"" + recordSeparator, sw.toString()); printer.close(); @@ -283,7 +283,7 @@ public class CSVPrinterTest { @Test public void testPrinter6() throws IOException { final StringWriter sw = new StringWriter(); - final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES); + final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b\r\nc"); assertEquals("a,\"b\r\nc\"" + recordSeparator, sw.toString()); printer.close(); @@ -292,7 +292,7 @@ public class CSVPrinterTest { @Test public void testPrinter7() throws IOException { final StringWriter sw = new StringWriter(); - final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES); + final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b\\c"); assertEquals("a,b\\c" + recordSeparator, sw.toString()); printer.close(); @@ -301,7 +301,7 @@ public class CSVPrinterTest { @Test public void testPrintNullValues() throws IOException { final StringWriter sw = new StringWriter(); - final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180_EMPTY_LINES); + final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", null, "b"); assertEquals("a,,b" + recordSeparator, sw.toString()); printer.close(); @@ -328,7 +328,7 @@ public class CSVPrinterTest { @Test public void testRandom() throws Exception { final int iter = 10000; - doRandom(CSVFormat.RFC4180_EMPTY_LINES, iter); + doRandom(CSVFormat.DEFAULT, iter); doRandom(CSVFormat.EXCEL, iter); doRandom(CSVFormat.MYSQL, iter); }