You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/02/02 01:03:51 UTC

[commons-csv] branch master updated (70092bb -> a35797b)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git.


    from 70092bb  Document intent to remove Serializable from CSVRecord.
     new df9da10  Prepare for 1.8-RC2.
     new afad1de  Prepare for 1.8-RC2.
     new a35797b  Prepare for 1.8-RC2.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 RELEASE-NOTES.txt                                  |  8 +++--
 pom.xml                                            |  2 +-
 src/changes/changes.xml                            |  2 +-
 .../org/apache/commons/csv/CSVFileParserTest.java  |  6 ++--
 .../java/org/apache/commons/csv/CSVFormatTest.java | 10 +++---
 .../org/apache/commons/csv/CSVPrinterTest.java     | 39 ++++++++++++++--------
 .../java/org/apache/commons/csv/CSVRecordTest.java |  2 +-
 .../apache/commons/csv/issues/JiraCsv213Test.java  |  1 -
 .../apache/commons/csv/issues/JiraCsv248Test.java  |  2 +-
 9 files changed, 43 insertions(+), 29 deletions(-)


[commons-csv] 03/03: Prepare for 1.8-RC2.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git

commit a35797bea9bd7f7affa7ae94576bd471d822b01b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Feb 1 20:03:26 2020 -0500

    Prepare for 1.8-RC2.
---
 RELEASE-NOTES.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 711be37..da85ce2 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -5,14 +5,16 @@
 
 INTRODUCTION:
 
-This document contains the release notes for the 1.8 version of Apache Commons CSV.
+This document contains the release notes for the 1.8-SNAPSHOT version of Apache Commons CSV.
 Commons CSV reads and writes files in variations of the Comma Separated Value (CSV) format.
 
 Commons CSV requires at least Java 6.
 
 The Apache Commons CSV library provides a simple interface for reading and writing CSV files of various types.
 
-Feature and bug fix release (Java 8)
+Feature and bug fix release (Java 8).
+This release fixes serialization compatibility of CSVRecord with versions 1.0 to 1.6. New fields added since 
+1.7 are not serialized. Support for Serializable is scheduled to be removed in version 2.0.
 
 Changes in this version include:
 
@@ -32,6 +34,7 @@ o CSV-241:  CSVFormat#validate() does not account for allowDuplicateHeaderNames
 o CSV-245:  Post 1.7 release fixes. Thanks to Alex Herbert.
 o CSV-252:  Upgrade test framework to JUnit 5 Jupiter #49, #50. Thanks to Alex Herbert.
 o CSV-247:  A single empty header is allowed when not allowing empty column headers. #47. Thanks to Alex Herbert, Gary Gregory.
+o CSV-248:  CSVRecord is not Serializable. Thanks to Alex Herbert.
 o           Use test scope for supercsv #48. Thanks to Alex Herbert.
 
 CHANGES
@@ -41,6 +44,7 @@ o           Update tests from H2 1.4.199 to 1.4.200. Thanks to Gary Gregory.
 o           Update tests from Hamcrest 2.1 to 2.2. Thanks to Gary Gregory.
 o           Update tests from Mockito 3.1.0 to 3.2.4. Thanks to Gary Gregory.
 o           Fix typos in site and test #53. Thanks to Chen.
+o           Fix typo performance test #55. Thanks to Chen.
 
 
 Historical list of changes: https://commons.apache.org/proper/commons-csv/changes-report.html


[commons-csv] 01/03: Prepare for 1.8-RC2.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git

commit df9da1056b47ad450902c1caf97124a2e4d2a9b8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Feb 1 20:01:01 2020 -0500

    Prepare for 1.8-RC2.
    
    - Remove package private code with Java 8 equivalent
    java.util.Objects.requirteNonNull().
    - Checkstyle fixes.
    - Use final.
    - Remove unused import.
---
 pom.xml                                            |  2 +-
 .../org/apache/commons/csv/CSVFileParserTest.java  |  6 ++--
 .../java/org/apache/commons/csv/CSVFormatTest.java | 10 +++---
 .../org/apache/commons/csv/CSVPrinterTest.java     | 39 ++++++++++++++--------
 .../java/org/apache/commons/csv/CSVRecordTest.java |  2 +-
 .../apache/commons/csv/issues/JiraCsv213Test.java  |  1 -
 .../apache/commons/csv/issues/JiraCsv248Test.java  |  2 +-
 7 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/pom.xml b/pom.xml
index 466961b..042cb0f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -140,7 +140,7 @@
     <commons.release.version>1.8</commons.release.version>
     <commons.release.desc>(Java 8)</commons.release.desc>
     <!-- The RC version used in the staging repository URL. -->
-    <commons.rc.version>RC1</commons.rc.version>
+    <commons.rc.version>RC2</commons.rc.version>
     <commons.bc.version>1.7</commons.bc.version>
     <commons.componentid>csv</commons.componentid>
     <commons.module.name>org.apache.commons.csv</commons.module.name>
diff --git a/src/test/java/org/apache/commons/csv/CSVFileParserTest.java b/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
index 52813a3..8e274f9 100644
--- a/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
@@ -42,7 +42,7 @@ public class CSVFileParserTest {
 
     private static final File BASE = new File("src/test/resources/CSVFileParser");
 
-    private String readTestData(BufferedReader reader) throws IOException {
+    private String readTestData(final BufferedReader reader) throws IOException {
         String line;
         do {
             line = reader.readLine();
@@ -61,7 +61,7 @@ public class CSVFileParserTest {
 
     @ParameterizedTest
     @MethodSource("generateData")
-    public void testCSVFile(File testFile) throws Exception {
+    public void testCSVFile(final File testFile) throws Exception {
         try (FileReader fr = new FileReader(testFile); BufferedReader testData = new BufferedReader(fr)) {
             String line = readTestData(testData);
             assertNotNull("file must contain config line", line);
@@ -108,7 +108,7 @@ public class CSVFileParserTest {
 
     @ParameterizedTest
     @MethodSource("generateData")
-    public void testCSVUrl(File testFile) throws Exception {
+    public void testCSVUrl(final File testFile) throws Exception {
         try (FileReader fr = new FileReader(testFile); BufferedReader testData = new BufferedReader(fr)) {
             String line = readTestData(testData);
             assertNotNull("file must contain config line", line);
diff --git a/src/test/java/org/apache/commons/csv/CSVFormatTest.java b/src/test/java/org/apache/commons/csv/CSVFormatTest.java
index c7f9885..d7173a7 100644
--- a/src/test/java/org/apache/commons/csv/CSVFormatTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVFormatTest.java
@@ -64,7 +64,7 @@ public class CSVFormatTest {
         return format.withDelimiter(format.getDelimiter());
     }
 
-    private void assertNotEquals(String name, String type, Object left, Object right) {
+    private void assertNotEquals(final String name, final String type, final Object left, final Object right) {
         if (left.equals(right) || right.equals(left)) {
             fail("Objects must not compare equal for " + name + "(" + type + ")");
         }
@@ -153,12 +153,12 @@ public class CSVFormatTest {
 
     @Test
     public void testEqualsHash() throws Exception {
-        Method[] methods = CSVFormat.class.getDeclaredMethods();
-        for (Method method : methods) {
+        final Method[] methods = CSVFormat.class.getDeclaredMethods();
+        for (final Method method : methods) {
             if (Modifier.isPublic(method.getModifiers())) {
                final String name = method.getName();
                if (name.startsWith("with")) {
-                   for (Class<?> cls : method.getParameterTypes()) {
+                   for (final Class<?> cls : method.getParameterTypes()) {
                        final String type = cls.getCanonicalName();
                        if ("boolean".equals(type)) {
                            final Object defTrue = method.invoke(CSVFormat.DEFAULT, new Object[] {Boolean.TRUE});
@@ -550,7 +550,7 @@ public class CSVFormatTest {
 
         final CSVFormat csvFormat = CSVFormat.MYSQL;
 
-        NullPointerException e = assertThrows(NullPointerException.class, () -> csvFormat.format((Object[]) null));
+        final NullPointerException e = assertThrows(NullPointerException.class, () -> csvFormat.format((Object[]) null));
         assertEquals(CSVFormat.class.getName(), e.getStackTrace()[0].getClassName());
     }
 
diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
index b3bc910..cb26848 100644
--- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
@@ -289,15 +289,25 @@ public class CSVPrinterTest {
 
     @Test
     public void testCSV135() throws IOException {
-        List<String> l = new LinkedList<String>();
-        l.add("\"\"");   // ""
-        l.add("\\\\");   // \\
-        l.add("\\\"\\"); // \"\
-        tryFormat(l, null, null, "\"\",\\\\,\\\"\\"); // "",\\,\"\ (unchanged)
-        tryFormat(l, '"',  null, "\"\"\"\"\"\",\\\\,\"\\\"\"\\\"");              // """""",\\,"\""\" (quoted, and embedded DQ doubled)
-        tryFormat(l, null, '\\', "\"\",\\\\\\\\,\\\\\"\\\\");                    // "",\\\\,\\"\\ (escapes escaped, not quoted)
-        tryFormat(l, '"',  '\\', "\"\\\"\\\"\",\"\\\\\\\\\",\"\\\\\\\"\\\\\"");  // "\"\"","\\\\","\\\"\\" (quoted, and embedded DQ & escape escaped)
-        tryFormat(l, '"',  '"',  "\"\"\"\"\"\",\\\\,\"\\\"\"\\\"");              // """""",\\,"\""\" (quoted, embedded DQ escaped)
+        final List<String> list = new LinkedList<>();
+        list.add("\"\"");   // ""
+        list.add("\\\\");   // \\
+        list.add("\\\"\\"); // \"\
+        //
+        // "",\\,\"\ (unchanged)
+        tryFormat(list, null, null, "\"\",\\\\,\\\"\\");
+        //
+        // """""",\\,"\""\" (quoted, and embedded DQ doubled)
+        tryFormat(list, '"',  null, "\"\"\"\"\"\",\\\\,\"\\\"\"\\\"");
+        //
+        // "",\\\\,\\"\\ (escapes escaped, not quoted)
+        tryFormat(list, null, '\\', "\"\",\\\\\\\\,\\\\\"\\\\");
+        //
+        // "\"\"","\\\\","\\\"\\" (quoted, and embedded DQ & escape escaped)
+        tryFormat(list, '"',  '\\', "\"\\\"\\\"\",\"\\\\\\\\\",\"\\\\\\\"\\\\\"");
+        //
+        // """""",\\,"\""\" (quoted, embedded DQ escaped)
+        tryFormat(list, '"',  '"',  "\"\"\"\"\"\",\\\\,\"\\\"\"\\\"");
     }
 
     @Test
@@ -772,7 +782,8 @@ public class CSVPrinterTest {
     @Test
     public void testMySqlNullOutput() throws IOException {
         Object[] s = new String[] { "NULL", null };
-        CSVFormat format = CSVFormat.MYSQL.withQuote(DQUOTE_CHAR).withNullString("NULL").withQuoteMode(QuoteMode.NON_NUMERIC);
+        CSVFormat format = CSVFormat.MYSQL.withQuote(DQUOTE_CHAR).withNullString("NULL")
+            .withQuoteMode(QuoteMode.NON_NUMERIC);
         StringWriter writer = new StringWriter();
         try (final CSVPrinter printer = new CSVPrinter(writer, format)) {
             printer.printRecord(s);
@@ -1519,10 +1530,10 @@ public class CSVPrinterTest {
         return CSVParser.parse(expected, format).getRecords().get(0).values();
     }
 
-    private void tryFormat(List<String> l, Character quote, Character escape, String expected) throws IOException {
-        CSVFormat format = CSVFormat.DEFAULT.withQuote(quote).withEscape(escape).withRecordSeparator(null);
-        Appendable out = new StringBuilder();
-        CSVPrinter printer = new CSVPrinter(out, format);
+    private void tryFormat(final List<String> l, final Character quote, final Character escape, final String expected) throws IOException {
+        final CSVFormat format = CSVFormat.DEFAULT.withQuote(quote).withEscape(escape).withRecordSeparator(null);
+        final Appendable out = new StringBuilder();
+        final CSVPrinter printer = new CSVPrinter(out, format);
         printer.printRecord(l);
         printer.close();
         assertEquals(expected, out.toString());
diff --git a/src/test/java/org/apache/commons/csv/CSVRecordTest.java b/src/test/java/org/apache/commons/csv/CSVRecordTest.java
index 8ed51c3..d66acfa 100644
--- a/src/test/java/org/apache/commons/csv/CSVRecordTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVRecordTest.java
@@ -226,7 +226,7 @@ public class CSVRecordTest {
             try {
                 rec.get("A");
                 org.junit.jupiter.api.Assertions.fail("Access by name is not expected after deserialisation");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
                 // OK
             }
         }
diff --git a/src/test/java/org/apache/commons/csv/issues/JiraCsv213Test.java b/src/test/java/org/apache/commons/csv/issues/JiraCsv213Test.java
index 88dc70b..b612b62 100644
--- a/src/test/java/org/apache/commons/csv/issues/JiraCsv213Test.java
+++ b/src/test/java/org/apache/commons/csv/issues/JiraCsv213Test.java
@@ -24,7 +24,6 @@ import java.nio.charset.StandardCharsets;
 
 import org.apache.commons.csv.CSVFormat;
 import org.apache.commons.csv.CSVParser;
-import org.apache.commons.csv.CSVRecord;
 import org.apache.commons.csv.QuoteMode;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
diff --git a/src/test/java/org/apache/commons/csv/issues/JiraCsv248Test.java b/src/test/java/org/apache/commons/csv/issues/JiraCsv248Test.java
index efbe09f..bf640b6 100644
--- a/src/test/java/org/apache/commons/csv/issues/JiraCsv248Test.java
+++ b/src/test/java/org/apache/commons/csv/issues/JiraCsv248Test.java
@@ -68,7 +68,7 @@ public class JiraCsv248Test {
             try {
                 rec.get("A");
                 org.junit.jupiter.api.Assertions.fail("Access by name is not expected after deserialisation");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
                 // OK
             }
         }


[commons-csv] 02/03: Prepare for 1.8-RC2.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git

commit afad1de6efc224fa167a482f083184daa956cb3a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Feb 1 20:01:35 2020 -0500

    Prepare for 1.8-RC2.
---
 src/changes/changes.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 2865d8f..345cd9d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -38,7 +38,7 @@
     <title>Apache Commons CSV Release Notes</title>
   </properties>
   <body>
-    <release version="1.8" date="2019-01-DD" description="Feature and bug fix release (Java 8).
+    <release version="1.8" date="2019-02-01" description="Feature and bug fix release (Java 8).
 
 This release fixes serialization compatibility of CSVRecord with versions 1.0 to 1.6.
 New fields added since 1.7 are not serialized. Support for Serializable is scheduled to be