You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by st...@apache.org on 2018/02/09 14:21:26 UTC
[01/34] commons-csv git commit: Fix checkstyle errors by replacing
tabs by spaces
Repository: commons-csv
Updated Branches:
refs/heads/CSV-216 41101f124 -> d482fd289
Fix checkstyle errors by replacing tabs by spaces
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/87b75e02
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/87b75e02
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/87b75e02
Branch: refs/heads/CSV-216
Commit: 87b75e02a329cf752c98023cdb2ade3ebd0259fe
Parents: 259812e
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sat Aug 26 19:25:33 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sat Aug 26 19:55:38 2017 +1200
----------------------------------------------------------------------
.../java/org/apache/commons/csv/CSVFormat.java | 40 ++++++++++----------
1 file changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/87b75e02/src/main/java/org/apache/commons/csv/CSVFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index bae5a97..410c8fb 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -275,8 +275,8 @@ public final class CSVFormat implements Serializable {
*/
// @formatter:off
public static final CSVFormat EXCEL = DEFAULT
- .withIgnoreEmptyLines(false)
- .withAllowMissingColumnNames();
+ .withIgnoreEmptyLines(false)
+ .withAllowMissingColumnNames();
// @formatter:on
/**
@@ -305,8 +305,8 @@ public final class CSVFormat implements Serializable {
*/
// @formatter:off
public static final CSVFormat INFORMIX_UNLOAD = DEFAULT
- .withDelimiter(PIPE)
- .withEscape(BACKSLASH)
+ .withDelimiter(PIPE)
+ .withEscape(BACKSLASH)
.withQuote(DOUBLE_QUOTE_CHAR)
.withRecordSeparator(LF);
// @formatter:on
@@ -336,8 +336,8 @@ public final class CSVFormat implements Serializable {
*/
// @formatter:off
public static final CSVFormat INFORMIX_UNLOAD_CSV = DEFAULT
- .withDelimiter(COMMA)
- .withQuote(DOUBLE_QUOTE_CHAR)
+ .withDelimiter(COMMA)
+ .withQuote(DOUBLE_QUOTE_CHAR)
.withRecordSeparator(LF);
// @formatter:on
@@ -368,13 +368,13 @@ public final class CSVFormat implements Serializable {
*/
// @formatter:off
public static final CSVFormat MYSQL = DEFAULT
- .withDelimiter(TAB)
- .withEscape(BACKSLASH)
- .withIgnoreEmptyLines(false)
+ .withDelimiter(TAB)
+ .withEscape(BACKSLASH)
+ .withIgnoreEmptyLines(false)
.withQuote(null)
.withRecordSeparator(LF)
.withNullString("\\N")
- .withQuoteMode(QuoteMode.ALL_NON_NULL);
+ .withQuoteMode(QuoteMode.ALL_NON_NULL);
// @formatter:off
/**
@@ -405,13 +405,13 @@ public final class CSVFormat implements Serializable {
*/
// @formatter:off
public static final CSVFormat POSTGRESQL_CSV = DEFAULT
- .withDelimiter(COMMA)
- .withEscape(DOUBLE_QUOTE_CHAR)
- .withIgnoreEmptyLines(false)
+ .withDelimiter(COMMA)
+ .withEscape(DOUBLE_QUOTE_CHAR)
+ .withIgnoreEmptyLines(false)
.withQuote(DOUBLE_QUOTE_CHAR)
.withRecordSeparator(LF)
.withNullString(EMPTY)
- .withQuoteMode(QuoteMode.ALL_NON_NULL);
+ .withQuoteMode(QuoteMode.ALL_NON_NULL);
// @formatter:off
/**
@@ -442,13 +442,13 @@ public final class CSVFormat implements Serializable {
*/
// @formatter:off
public static final CSVFormat POSTGRESQL_TEXT = DEFAULT
- .withDelimiter(TAB)
- .withEscape(DOUBLE_QUOTE_CHAR)
- .withIgnoreEmptyLines(false)
+ .withDelimiter(TAB)
+ .withEscape(DOUBLE_QUOTE_CHAR)
+ .withIgnoreEmptyLines(false)
.withQuote(DOUBLE_QUOTE_CHAR)
.withRecordSeparator(LF)
.withNullString("\\N")
- .withQuoteMode(QuoteMode.ALL_NON_NULL);
+ .withQuoteMode(QuoteMode.ALL_NON_NULL);
// @formatter:off
/**
@@ -487,8 +487,8 @@ public final class CSVFormat implements Serializable {
*/
// @formatter:off
public static final CSVFormat TDF = DEFAULT
- .withDelimiter(TAB)
- .withIgnoreSurroundingSpaces();
+ .withDelimiter(TAB)
+ .withIgnoreSurroundingSpaces();
// @formatter:on
/**
[27/34] commons-csv git commit: Update tests from Apache Commons Lang
3.6 to 3.7.
Posted by st...@apache.org.
Update tests from Apache Commons Lang 3.6 to 3.7.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/e76c4d80
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/e76c4d80
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/e76c4d80
Branch: refs/heads/CSV-216
Commit: e76c4d809cf2b39a9d7fe831b63e60891fe47f55
Parents: c6cd6ce
Author: ggregory <gg...@US-L-GG05.rocketsoftware.com>
Authored: Sun Dec 10 16:27:09 2017 -0700
Committer: ggregory <gg...@US-L-GG05.rocketsoftware.com>
Committed: Sun Dec 10 16:27:09 2017 -0700
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/e76c4d80/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8623b92..68fb8e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -53,7 +53,7 @@ CSV files of various types.
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
- <version>3.6</version>
+ <version>3.7</version>
<scope>test</scope>
</dependency>
<dependency>
[05/34] commons-csv git commit: Update NOTICE.txt copyright year for
1.5 release
Posted by st...@apache.org.
Update NOTICE.txt copyright year for 1.5 release
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/d032c24a
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/d032c24a
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/d032c24a
Branch: refs/heads/CSV-216
Commit: d032c24af920077ef9661982690d80561e49e5ba
Parents: 1067138
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sat Aug 26 20:06:18 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Aug 27 10:51:00 2017 +1200
----------------------------------------------------------------------
NOTICE.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/d032c24a/NOTICE.txt
----------------------------------------------------------------------
diff --git a/NOTICE.txt b/NOTICE.txt
index 9eac639..14c9397 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,5 +1,5 @@
Apache Commons CSV
-Copyright 2005-2016 The Apache Software Foundation
+Copyright 2005-2017 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
[13/34] commons-csv git commit: Update CSV 1.5 release date in
changes.xml
Posted by st...@apache.org.
Update CSV 1.5 release date in changes.xml
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/edb87f3a
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/edb87f3a
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/edb87f3a
Branch: refs/heads/CSV-216
Commit: edb87f3a5e53c2160fc3da79f066beb4459c707c
Parents: 3e3c236
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sun Sep 3 17:48:13 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Sep 3 17:48:13 2017 +1200
----------------------------------------------------------------------
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/edb87f3a/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 62fe6c2..039d15f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -38,7 +38,7 @@
<title>Release Notes</title>
</properties>
<body>
- <release version="1.5" date="2017-08-26" description="Feature and bug fix release">
+ <release version="1.5" date="2017-09-03" description="Feature and bug fix release">
<action issue="CSV-203" type="fix" dev="ggregory" due-to="Richard Wheeldon, Kai Paroth">withNullString value is printed without quotes when QuoteMode.ALL is specified; add QuoteMode.ALL_NON_NULL. PR #17.</action>
<action issue="CSV-194" type="fix" dev="ggregory" due-to="Marc Prud'hommeaux">Fix outdated comments about FileReader in CSVParser #13</action>
<action issue="CSV-193" type="fix" dev="ggregory" due-to="Matthias Wiehl">Fix incorrect method name 'withFirstRowAsHeader' in user guide.</action>
[02/34] commons-csv git commit: Fix last checkstyle error
Posted by st...@apache.org.
Fix last checkstyle error
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/f7d7d63e
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/f7d7d63e
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/f7d7d63e
Branch: refs/heads/CSV-216
Commit: f7d7d63ee14e8040dad6f2ae7893daad25c2ee55
Parents: 87b75e0
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sat Aug 26 19:33:27 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sat Aug 26 19:56:03 2017 +1200
----------------------------------------------------------------------
src/main/java/org/apache/commons/csv/CSVParser.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/f7d7d63e/src/main/java/org/apache/commons/csv/CSVParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java b/src/main/java/org/apache/commons/csv/CSVParser.java
index 8851211..09251a3 100644
--- a/src/main/java/org/apache/commons/csv/CSVParser.java
+++ b/src/main/java/org/apache/commons/csv/CSVParser.java
@@ -177,7 +177,8 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
* @since 1.5
*/
@SuppressWarnings("resource")
- public static CSVParser parse(final InputStream inputStream, final Charset charset, final CSVFormat format) throws IOException {
+ public static CSVParser parse(final InputStream inputStream, final Charset charset, final CSVFormat format)
+ throws IOException {
Assertions.notNull(inputStream, "inputStream");
Assertions.notNull(format, "format");
return parse(new InputStreamReader(inputStream, charset), format);
[22/34] commons-csv git commit: travis: add java 9 to build (closes
#23)
Posted by st...@apache.org.
travis: add java 9 to build (closes #23)
pom.xml: add java 9 profile and override jacoco version to make build pass
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/d20e5aba
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/d20e5aba
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/d20e5aba
Branch: refs/heads/CSV-216
Commit: d20e5abaa3bd1718de4e5e8d1caf6b7dbdcfa021
Parents: 27cdc55
Author: Pascal Schumacher <pa...@gmx.net>
Authored: Mon Oct 2 12:02:32 2017 +0200
Committer: pascalschumacher <pa...@gmx.net>
Committed: Thu Oct 12 22:41:08 2017 +0200
----------------------------------------------------------------------
.travis.yml | 1 +
pom.xml | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/d20e5aba/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index a697e28..d842196 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,6 +22,7 @@ script:
jdk:
- openjdk7
- oraclejdk8
+ - oraclejdk9
after_success:
- mvn -B -V -Ptravis-jacoco clean test jacoco:report coveralls:report
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/d20e5aba/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8011872..e3533e3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -152,6 +152,9 @@ CSV files of various types.
<checkstyle.version>2.17</checkstyle.version>
<checkstyle.header.file>${basedir}/LICENSE-header.txt</checkstyle.header.file>
<checkstyle.resourceExcludes>LICENSE.txt, NOTICE.txt</checkstyle.resourceExcludes>
+
+ <!-- Override jacoco version for java 9 compatibility -->
+ <commons.jacoco.version>0.7.9</commons.jacoco.version>
</properties>
<build>
@@ -512,6 +515,19 @@ CSV files of various types.
</plugins>
</build>
</profile>
+
+ <profile>
+ <id>java9</id>
+ <activation>
+ <jdk>9</jdk>
+ </activation>
+ <properties>
+ <!-- versions below 3.0.0 do not work with java 9 -->
+ <commons.javadoc.version>3.0.0-M1</commons.javadoc.version>
+ <!-- coverall version 4.3.0 does not work with java 9, see https://github.com/trautonen/coveralls-maven-plugin/issues/112 -->
+ <coveralls.skip>true</coveralls.skip>
+ </properties>
+ </profile>
</profiles>
</project>
[07/34] commons-csv git commit: Update version for Commons Csv
release 1.5
Posted by st...@apache.org.
Update version for Commons Csv release 1.5
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/dfcd0793
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/dfcd0793
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/dfcd0793
Branch: refs/heads/CSV-216
Commit: dfcd0793c0cb0eb49ce4dd455a5959fe51b7f8ef
Parents: 9d2b6d7
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sat Aug 26 19:58:02 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Aug 27 10:51:00 2017 +1200
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/dfcd0793/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e05d463..232a5de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<version>42</version>
</parent>
<artifactId>commons-csv</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
<name>Apache Commons CSV</name>
<url>http://commons.apache.org/proper/commons-csv/</url>
<description>
[29/34] commons-csv git commit: Sort methods.
Posted by st...@apache.org.
Sort methods.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/4f58df6d
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/4f58df6d
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/4f58df6d
Branch: refs/heads/CSV-216
Commit: 4f58df6d4a41ef489ed117fb58a93b68328ec5ed
Parents: 8b3de71
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Dec 11 11:42:09 2017 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Dec 11 11:42:09 2017 -0700
----------------------------------------------------------------------
.../org/apache/commons/csv/CSVFormatTest.java | 824 +++++++++----------
1 file changed, 412 insertions(+), 412 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/4f58df6d/src/test/java/org/apache/commons/csv/CSVFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/csv/CSVFormatTest.java b/src/test/java/org/apache/commons/csv/CSVFormatTest.java
index 7eb0ce5..9a69780 100644
--- a/src/test/java/org/apache/commons/csv/CSVFormatTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVFormatTest.java
@@ -44,6 +44,13 @@ import org.junit.Test;
*/
public class CSVFormatTest {
+ public enum EmptyEnum {
+ }
+
+ public enum Header {
+ Name, Email, Phone
+ }
+
private static void assertNotEquals(final Object right, final Object left) {
assertFalse(right.equals(left));
assertFalse(left.equals(right));
@@ -164,14 +171,6 @@ public class CSVFormatTest {
}
@Test
- public void testEqualsQuoteChar() {
- final CSVFormat right = CSVFormat.newFormat('\'').withQuote('"');
- final CSVFormat left = right.withQuote('!');
-
- assertNotEquals(right, left);
- }
-
- @Test
public void testEqualsLeftNoQuoteRightQuote() {
final CSVFormat left = CSVFormat.newFormat(',').withQuote(null);
final CSVFormat right = left.withQuote('#');
@@ -188,34 +187,172 @@ public class CSVFormatTest {
}
@Test
- public void testEqualsQuotePolicy() {
+ public void testEqualsNullString() {
final CSVFormat right = CSVFormat.newFormat('\'')
+ .withRecordSeparator(CR)
+ .withCommentMarker('#')
+ .withEscape('+')
+ .withIgnoreEmptyLines()
+ .withIgnoreSurroundingSpaces()
.withQuote('"')
- .withQuoteMode(QuoteMode.ALL);
+ .withQuoteMode(QuoteMode.ALL)
+ .withNullString("null");
final CSVFormat left = right
- .withQuoteMode(QuoteMode.MINIMAL);
+ .withNullString("---");
assertNotEquals(right, left);
}
@Test
- public void testEqualsRecordSeparator() {
+ public void testEqualsOne() {
+
+ final CSVFormat cSVFormatOne = CSVFormat.INFORMIX_UNLOAD;
+ final CSVFormat cSVFormatTwo = CSVFormat.MYSQL;
+
+
+ assertEquals('\\', (char)cSVFormatOne.getEscapeCharacter());
+ assertNull(cSVFormatOne.getQuoteMode());
+
+ assertTrue(cSVFormatOne.getIgnoreEmptyLines());
+ assertFalse(cSVFormatOne.getSkipHeaderRecord());
+
+ assertFalse(cSVFormatOne.getIgnoreHeaderCase());
+ assertNull(cSVFormatOne.getCommentMarker());
+
+ assertFalse(cSVFormatOne.isCommentMarkerSet());
+ assertTrue(cSVFormatOne.isQuoteCharacterSet());
+
+ assertEquals('|', cSVFormatOne.getDelimiter());
+ assertFalse(cSVFormatOne.getAllowMissingColumnNames());
+
+ assertTrue(cSVFormatOne.isEscapeCharacterSet());
+ assertEquals("\n", cSVFormatOne.getRecordSeparator());
+
+ assertEquals('\"', (char)cSVFormatOne.getQuoteCharacter());
+ assertFalse(cSVFormatOne.getTrailingDelimiter());
+
+ assertFalse(cSVFormatOne.getTrim());
+ assertFalse(cSVFormatOne.isNullStringSet());
+
+ assertNull(cSVFormatOne.getNullString());
+ assertFalse(cSVFormatOne.getIgnoreSurroundingSpaces());
+
+
+ assertTrue(cSVFormatTwo.isEscapeCharacterSet());
+ assertNull(cSVFormatTwo.getQuoteCharacter());
+
+ assertFalse(cSVFormatTwo.getAllowMissingColumnNames());
+ assertEquals(QuoteMode.ALL_NON_NULL, cSVFormatTwo.getQuoteMode());
+
+ assertEquals('\t', cSVFormatTwo.getDelimiter());
+ assertEquals("\n", cSVFormatTwo.getRecordSeparator());
+
+ assertFalse(cSVFormatTwo.isQuoteCharacterSet());
+ assertTrue(cSVFormatTwo.isNullStringSet());
+
+ assertEquals('\\', (char)cSVFormatTwo.getEscapeCharacter());
+ assertFalse(cSVFormatTwo.getIgnoreHeaderCase());
+
+ assertFalse(cSVFormatTwo.getTrim());
+ assertFalse(cSVFormatTwo.getIgnoreEmptyLines());
+
+ assertEquals("\\N", cSVFormatTwo.getNullString());
+ assertFalse(cSVFormatTwo.getIgnoreSurroundingSpaces());
+
+ assertFalse(cSVFormatTwo.getTrailingDelimiter());
+ assertFalse(cSVFormatTwo.getSkipHeaderRecord());
+
+ assertNull(cSVFormatTwo.getCommentMarker());
+ assertFalse(cSVFormatTwo.isCommentMarkerSet());
+
+ assertNotSame(cSVFormatTwo, cSVFormatOne);
+ assertFalse(cSVFormatTwo.equals(cSVFormatOne));
+
+ assertEquals('\\', (char)cSVFormatOne.getEscapeCharacter());
+ assertNull(cSVFormatOne.getQuoteMode());
+
+ assertTrue(cSVFormatOne.getIgnoreEmptyLines());
+ assertFalse(cSVFormatOne.getSkipHeaderRecord());
+
+ assertFalse(cSVFormatOne.getIgnoreHeaderCase());
+ assertNull(cSVFormatOne.getCommentMarker());
+
+ assertFalse(cSVFormatOne.isCommentMarkerSet());
+ assertTrue(cSVFormatOne.isQuoteCharacterSet());
+
+ assertEquals('|', cSVFormatOne.getDelimiter());
+ assertFalse(cSVFormatOne.getAllowMissingColumnNames());
+
+ assertTrue(cSVFormatOne.isEscapeCharacterSet());
+ assertEquals("\n", cSVFormatOne.getRecordSeparator());
+
+ assertEquals('\"', (char)cSVFormatOne.getQuoteCharacter());
+ assertFalse(cSVFormatOne.getTrailingDelimiter());
+
+ assertFalse(cSVFormatOne.getTrim());
+ assertFalse(cSVFormatOne.isNullStringSet());
+
+ assertNull(cSVFormatOne.getNullString());
+ assertFalse(cSVFormatOne.getIgnoreSurroundingSpaces());
+
+ assertTrue(cSVFormatTwo.isEscapeCharacterSet());
+ assertNull(cSVFormatTwo.getQuoteCharacter());
+
+ assertFalse(cSVFormatTwo.getAllowMissingColumnNames());
+ assertEquals(QuoteMode.ALL_NON_NULL, cSVFormatTwo.getQuoteMode());
+
+ assertEquals('\t', cSVFormatTwo.getDelimiter());
+ assertEquals("\n", cSVFormatTwo.getRecordSeparator());
+
+ assertFalse(cSVFormatTwo.isQuoteCharacterSet());
+ assertTrue(cSVFormatTwo.isNullStringSet());
+
+ assertEquals('\\', (char)cSVFormatTwo.getEscapeCharacter());
+ assertFalse(cSVFormatTwo.getIgnoreHeaderCase());
+
+ assertFalse(cSVFormatTwo.getTrim());
+ assertFalse(cSVFormatTwo.getIgnoreEmptyLines());
+
+ assertEquals("\\N", cSVFormatTwo.getNullString());
+ assertFalse(cSVFormatTwo.getIgnoreSurroundingSpaces());
+
+ assertFalse(cSVFormatTwo.getTrailingDelimiter());
+ assertFalse(cSVFormatTwo.getSkipHeaderRecord());
+
+ assertNull(cSVFormatTwo.getCommentMarker());
+ assertFalse(cSVFormatTwo.isCommentMarkerSet());
+
+ assertNotSame(cSVFormatOne, cSVFormatTwo);
+ assertNotSame(cSVFormatTwo, cSVFormatOne);
+
+ assertFalse(cSVFormatOne.equals(cSVFormatTwo));
+ assertFalse(cSVFormatTwo.equals(cSVFormatOne));
+
+ assertFalse(cSVFormatTwo.equals(cSVFormatOne));
+
+ }
+
+ @Test
+ public void testEqualsQuoteChar() {
+ final CSVFormat right = CSVFormat.newFormat('\'').withQuote('"');
+ final CSVFormat left = right.withQuote('!');
+
+ assertNotEquals(right, left);
+ }
+
+ @Test
+ public void testEqualsQuotePolicy() {
final CSVFormat right = CSVFormat.newFormat('\'')
- .withRecordSeparator(CR)
- .withCommentMarker('#')
- .withEscape('+')
- .withIgnoreEmptyLines()
- .withIgnoreSurroundingSpaces()
.withQuote('"')
.withQuoteMode(QuoteMode.ALL);
final CSVFormat left = right
- .withRecordSeparator(LF);
+ .withQuoteMode(QuoteMode.MINIMAL);
assertNotEquals(right, left);
}
@Test
- public void testEqualsNullString() {
+ public void testEqualsRecordSeparator() {
final CSVFormat right = CSVFormat.newFormat('\'')
.withRecordSeparator(CR)
.withCommentMarker('#')
@@ -223,10 +360,9 @@ public class CSVFormatTest {
.withIgnoreEmptyLines()
.withIgnoreSurroundingSpaces()
.withQuote('"')
- .withQuoteMode(QuoteMode.ALL)
- .withNullString("null");
+ .withQuoteMode(QuoteMode.ALL);
final CSVFormat left = right
- .withNullString("---");
+ .withRecordSeparator(LF);
assertNotEquals(right, left);
}
@@ -249,6 +385,69 @@ public class CSVFormatTest {
assertNotEquals(right, left);
}
+ @Test
+ public void testEqualsWithNull() {
+
+ final CSVFormat cSVFormat = CSVFormat.POSTGRESQL_TEXT;
+
+ assertEquals('\"', (char)cSVFormat.getEscapeCharacter());
+ assertFalse(cSVFormat.getIgnoreSurroundingSpaces());
+
+ assertFalse(cSVFormat.getTrailingDelimiter());
+ assertFalse(cSVFormat.getTrim());
+
+ assertTrue(cSVFormat.isQuoteCharacterSet());
+ assertEquals("\\N", cSVFormat.getNullString());
+
+ assertFalse(cSVFormat.getIgnoreHeaderCase());
+ assertTrue(cSVFormat.isEscapeCharacterSet());
+
+ assertFalse(cSVFormat.isCommentMarkerSet());
+ assertNull(cSVFormat.getCommentMarker());
+
+ assertFalse(cSVFormat.getAllowMissingColumnNames());
+ assertEquals(QuoteMode.ALL_NON_NULL, cSVFormat.getQuoteMode());
+
+ assertEquals('\t', cSVFormat.getDelimiter());
+ assertFalse(cSVFormat.getSkipHeaderRecord());
+
+ assertEquals("\n", cSVFormat.getRecordSeparator());
+ assertFalse(cSVFormat.getIgnoreEmptyLines());
+
+ assertEquals('\"', (char)cSVFormat.getQuoteCharacter());
+ assertTrue(cSVFormat.isNullStringSet());
+
+ assertEquals('\"', (char)cSVFormat.getEscapeCharacter());
+ assertFalse(cSVFormat.getIgnoreSurroundingSpaces());
+
+ assertFalse(cSVFormat.getTrailingDelimiter());
+ assertFalse(cSVFormat.getTrim());
+
+ assertTrue(cSVFormat.isQuoteCharacterSet());
+ assertEquals("\\N", cSVFormat.getNullString());
+
+ assertFalse(cSVFormat.getIgnoreHeaderCase());
+ assertTrue(cSVFormat.isEscapeCharacterSet());
+
+ assertFalse(cSVFormat.isCommentMarkerSet());
+ assertNull(cSVFormat.getCommentMarker());
+
+ assertFalse(cSVFormat.getAllowMissingColumnNames());
+ assertEquals(QuoteMode.ALL_NON_NULL, cSVFormat.getQuoteMode());
+
+ assertEquals('\t', cSVFormat.getDelimiter());
+ assertFalse(cSVFormat.getSkipHeaderRecord());
+
+ assertEquals("\n", cSVFormat.getRecordSeparator());
+ assertFalse(cSVFormat.getIgnoreEmptyLines());
+
+ assertEquals('\"', (char)cSVFormat.getQuoteCharacter());
+ assertTrue(cSVFormat.isNullStringSet());
+
+ assertFalse(cSVFormat.equals( null));
+
+ }
+
@Test(expected = IllegalArgumentException.class)
public void testEscapeSameAsCommentStartThrowsException() {
CSVFormat.DEFAULT.withEscape('!').withCommentMarker('!');
@@ -269,19 +468,111 @@ public class CSVFormatTest {
assertEquals("\"x,y\",z", format.format("x,y", "z"));
}
- @Test
- public void testGetHeader() throws Exception {
- final String[] header = new String[]{"one", "two", "three"};
- final CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(header);
- // getHeader() makes a copy of the header array.
- final String[] headerCopy = formatWithHeader.getHeader();
- headerCopy[0] = "A";
- headerCopy[1] = "B";
- headerCopy[2] = "C";
- assertFalse(Arrays.equals(formatWithHeader.getHeader(), headerCopy));
- assertNotSame(formatWithHeader.getHeader(), headerCopy);
- }
-
+ @Test //I assume this to be a defect.
+ public void testFormatThrowsNullPointerException() {
+
+ final CSVFormat cSVFormat = CSVFormat.MYSQL;
+
+ try {
+ cSVFormat.format(null);
+ fail("Expecting exception: NullPointerException");
+ } catch(final NullPointerException e) {
+ assertEquals(CSVFormat.class.getName(), e.getStackTrace()[0].getClassName());
+ }
+
+ }
+
+ @Test
+ public void testGetHeader() throws Exception {
+ final String[] header = new String[]{"one", "two", "three"};
+ final CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(header);
+ // getHeader() makes a copy of the header array.
+ final String[] headerCopy = formatWithHeader.getHeader();
+ headerCopy[0] = "A";
+ headerCopy[1] = "B";
+ headerCopy[2] = "C";
+ assertFalse(Arrays.equals(formatWithHeader.getHeader(), headerCopy));
+ assertNotSame(formatWithHeader.getHeader(), headerCopy);
+ }
+
+ @Test
+ public void testHashCodeAndWithIgnoreHeaderCase() {
+
+ final CSVFormat cSVFormat = CSVFormat.INFORMIX_UNLOAD_CSV;
+ final CSVFormat cSVFormatTwo = cSVFormat.withIgnoreHeaderCase();
+ cSVFormatTwo.hashCode();
+
+ assertTrue(cSVFormatTwo.getIgnoreHeaderCase());
+ assertFalse(cSVFormatTwo.getTrailingDelimiter());
+
+ assertTrue(cSVFormatTwo.equals(cSVFormat));
+ assertFalse(cSVFormatTwo.getAllowMissingColumnNames());
+
+ assertFalse(cSVFormatTwo.getTrim());
+
+ }
+
+ @Test
+ public void testNewFormat() {
+
+ final CSVFormat cSVFormat = CSVFormat.newFormat('X');
+
+ assertFalse(cSVFormat.getSkipHeaderRecord());
+ assertFalse(cSVFormat.isEscapeCharacterSet());
+
+ assertNull(cSVFormat.getRecordSeparator());
+ assertNull(cSVFormat.getQuoteMode());
+
+ assertNull(cSVFormat.getCommentMarker());
+ assertFalse(cSVFormat.getIgnoreHeaderCase());
+
+ assertFalse(cSVFormat.getAllowMissingColumnNames());
+ assertFalse(cSVFormat.getTrim());
+
+ assertFalse(cSVFormat.isNullStringSet());
+ assertNull(cSVFormat.getEscapeCharacter());
+
+ assertFalse(cSVFormat.getIgnoreSurroundingSpaces());
+ assertFalse(cSVFormat.getTrailingDelimiter());
+
+ assertEquals('X', cSVFormat.getDelimiter());
+ assertNull(cSVFormat.getNullString());
+
+ assertFalse(cSVFormat.isQuoteCharacterSet());
+ assertFalse(cSVFormat.isCommentMarkerSet());
+
+ assertNull(cSVFormat.getQuoteCharacter());
+ assertFalse(cSVFormat.getIgnoreEmptyLines());
+
+ assertFalse(cSVFormat.getSkipHeaderRecord());
+ assertFalse(cSVFormat.isEscapeCharacterSet());
+
+ assertNull(cSVFormat.getRecordSeparator());
+ assertNull(cSVFormat.getQuoteMode());
+
+ assertNull(cSVFormat.getCommentMarker());
+ assertFalse(cSVFormat.getIgnoreHeaderCase());
+
+ assertFalse(cSVFormat.getAllowMissingColumnNames());
+ assertFalse(cSVFormat.getTrim());
+
+ assertFalse(cSVFormat.isNullStringSet());
+ assertNull(cSVFormat.getEscapeCharacter());
+
+ assertFalse(cSVFormat.getIgnoreSurroundingSpaces());
+ assertFalse(cSVFormat.getTrailingDelimiter());
+
+ assertEquals('X', cSVFormat.getDelimiter());
+ assertNull(cSVFormat.getNullString());
+
+ assertFalse(cSVFormat.isQuoteCharacterSet());
+ assertFalse(cSVFormat.isCommentMarkerSet());
+
+ assertNull(cSVFormat.getQuoteCharacter());
+ assertFalse(cSVFormat.getIgnoreEmptyLines());
+
+ }
+
@Test
public void testNullRecordSeparatorCsv106() {
final CSVFormat format = CSVFormat.newFormat(';').withSkipHeaderRecord().withHeader("H1", "H2");
@@ -346,117 +637,13 @@ public class CSVFormatTest {
}
@Test
- public void testWithCommentStart() throws Exception {
- final CSVFormat formatWithCommentStart = CSVFormat.DEFAULT.withCommentMarker('#');
- assertEquals( Character.valueOf('#'), formatWithCommentStart.getCommentMarker());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testWithCommentStartCRThrowsException() {
- CSVFormat.DEFAULT.withCommentMarker(CR);
- }
-
- @Test
- public void testWithDelimiter() throws Exception {
- final CSVFormat formatWithDelimiter = CSVFormat.DEFAULT.withDelimiter('!');
- assertEquals('!', formatWithDelimiter.getDelimiter());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testWithDelimiterLFThrowsException() {
- CSVFormat.DEFAULT.withDelimiter(LF);
- }
-
- @Test
- public void testWithEscape() throws Exception {
- final CSVFormat formatWithEscape = CSVFormat.DEFAULT.withEscape('&');
- assertEquals(Character.valueOf('&'), formatWithEscape.getEscapeCharacter());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testWithEscapeCRThrowsExceptions() {
- CSVFormat.DEFAULT.withEscape(CR);
- }
-
- @Test
- public void testWithHeader() throws Exception {
- final String[] header = new String[]{"one", "two", "three"};
- // withHeader() makes a copy of the header array.
- final CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(header);
- assertArrayEquals(header, formatWithHeader.getHeader());
- assertNotSame(header, formatWithHeader.getHeader());
- }
-
- @Test
- public void testWithHeaderEnum() throws Exception {
- final CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(Header.class);
- assertArrayEquals(new String[]{ "Name", "Email", "Phone" }, formatWithHeader.getHeader());
- }
-
- @Test
- public void testWithEmptyEnum() throws Exception {
- final CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(EmptyEnum.class);
- Assert.assertTrue(formatWithHeader.getHeader().length == 0);
- }
-
- @Test
- public void testWithIgnoreEmptyLines() throws Exception {
- assertFalse(CSVFormat.DEFAULT.withIgnoreEmptyLines(false).getIgnoreEmptyLines());
- assertTrue(CSVFormat.DEFAULT.withIgnoreEmptyLines().getIgnoreEmptyLines());
- }
-
- @Test
- public void testWithIgnoreSurround() throws Exception {
- assertFalse(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(false).getIgnoreSurroundingSpaces());
- assertTrue(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces().getIgnoreSurroundingSpaces());
- }
-
- @Test
- public void testWithNullString() throws Exception {
- final CSVFormat formatWithNullString = CSVFormat.DEFAULT.withNullString("null");
- assertEquals("null", formatWithNullString.getNullString());
- }
-
- @Test
- public void testWithQuoteChar() throws Exception {
- final CSVFormat formatWithQuoteChar = CSVFormat.DEFAULT.withQuote('"');
- assertEquals(Character.valueOf('"'), formatWithQuoteChar.getQuoteCharacter());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testWithQuoteLFThrowsException() {
- CSVFormat.DEFAULT.withQuote(LF);
- }
-
- @Test
- public void testWithQuotePolicy() throws Exception {
- final CSVFormat formatWithQuotePolicy = CSVFormat.DEFAULT.withQuoteMode(QuoteMode.ALL);
- assertEquals(QuoteMode.ALL, formatWithQuotePolicy.getQuoteMode());
- }
-
- @Test
- public void testWithRecordSeparatorCR() throws Exception {
- final CSVFormat formatWithRecordSeparator = CSVFormat.DEFAULT.withRecordSeparator(CR);
- assertEquals(String.valueOf(CR), formatWithRecordSeparator.getRecordSeparator());
- }
+ public void testToString() {
- @Test
- public void testWithRecordSeparatorLF() throws Exception {
- final CSVFormat formatWithRecordSeparator = CSVFormat.DEFAULT.withRecordSeparator(LF);
- assertEquals(String.valueOf(LF), formatWithRecordSeparator.getRecordSeparator());
- }
+ final CSVFormat cSVFormat = CSVFormat.POSTGRESQL_TEXT;
+ final String string = cSVFormat.INFORMIX_UNLOAD.toString();
- @Test
- public void testWithRecordSeparatorCRLF() throws Exception {
- final CSVFormat formatWithRecordSeparator = CSVFormat.DEFAULT.withRecordSeparator(CRLF);
- assertEquals(CRLF, formatWithRecordSeparator.getRecordSeparator());
- }
+ assertEquals("Delimiter=<|> Escape=<\\> QuoteChar=<\"> RecordSeparator=<\n> EmptyLines:ignored SkipHeaderRecord:false", string);
- @Test
- public void testWithFirstRecordAsHeader() throws Exception {
- final CSVFormat formatWithFirstRecordAsHeader = CSVFormat.DEFAULT.withFirstRecordAsHeader();
- assertTrue(formatWithFirstRecordAsHeader.getSkipHeaderRecord());
- assertTrue(formatWithFirstRecordAsHeader.getHeader().length == 0);
}
@Test
@@ -621,68 +808,60 @@ public class CSVFormatTest {
}
-
@Test
- public void testNewFormat() {
+ public void testWithCommentStart() throws Exception {
+ final CSVFormat formatWithCommentStart = CSVFormat.DEFAULT.withCommentMarker('#');
+ assertEquals( Character.valueOf('#'), formatWithCommentStart.getCommentMarker());
+ }
- final CSVFormat cSVFormat = CSVFormat.newFormat('X');
+ @Test(expected = IllegalArgumentException.class)
+ public void testWithCommentStartCRThrowsException() {
+ CSVFormat.DEFAULT.withCommentMarker(CR);
+ }
- assertFalse(cSVFormat.getSkipHeaderRecord());
- assertFalse(cSVFormat.isEscapeCharacterSet());
+ @Test
+ public void testWithDelimiter() throws Exception {
+ final CSVFormat formatWithDelimiter = CSVFormat.DEFAULT.withDelimiter('!');
+ assertEquals('!', formatWithDelimiter.getDelimiter());
+ }
- assertNull(cSVFormat.getRecordSeparator());
- assertNull(cSVFormat.getQuoteMode());
+ @Test(expected = IllegalArgumentException.class)
+ public void testWithDelimiterLFThrowsException() {
+ CSVFormat.DEFAULT.withDelimiter(LF);
+ }
- assertNull(cSVFormat.getCommentMarker());
- assertFalse(cSVFormat.getIgnoreHeaderCase());
+ @Test
+ public void testWithEmptyEnum() throws Exception {
+ final CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(EmptyEnum.class);
+ Assert.assertTrue(formatWithHeader.getHeader().length == 0);
+ }
- assertFalse(cSVFormat.getAllowMissingColumnNames());
- assertFalse(cSVFormat.getTrim());
+ @Test
+ public void testWithEscape() throws Exception {
+ final CSVFormat formatWithEscape = CSVFormat.DEFAULT.withEscape('&');
+ assertEquals(Character.valueOf('&'), formatWithEscape.getEscapeCharacter());
+ }
- assertFalse(cSVFormat.isNullStringSet());
- assertNull(cSVFormat.getEscapeCharacter());
-
- assertFalse(cSVFormat.getIgnoreSurroundingSpaces());
- assertFalse(cSVFormat.getTrailingDelimiter());
-
- assertEquals('X', cSVFormat.getDelimiter());
- assertNull(cSVFormat.getNullString());
-
- assertFalse(cSVFormat.isQuoteCharacterSet());
- assertFalse(cSVFormat.isCommentMarkerSet());
-
- assertNull(cSVFormat.getQuoteCharacter());
- assertFalse(cSVFormat.getIgnoreEmptyLines());
-
- assertFalse(cSVFormat.getSkipHeaderRecord());
- assertFalse(cSVFormat.isEscapeCharacterSet());
-
- assertNull(cSVFormat.getRecordSeparator());
- assertNull(cSVFormat.getQuoteMode());
-
- assertNull(cSVFormat.getCommentMarker());
- assertFalse(cSVFormat.getIgnoreHeaderCase());
-
- assertFalse(cSVFormat.getAllowMissingColumnNames());
- assertFalse(cSVFormat.getTrim());
-
- assertFalse(cSVFormat.isNullStringSet());
- assertNull(cSVFormat.getEscapeCharacter());
-
- assertFalse(cSVFormat.getIgnoreSurroundingSpaces());
- assertFalse(cSVFormat.getTrailingDelimiter());
-
- assertEquals('X', cSVFormat.getDelimiter());
- assertNull(cSVFormat.getNullString());
-
- assertFalse(cSVFormat.isQuoteCharacterSet());
- assertFalse(cSVFormat.isCommentMarkerSet());
-
- assertNull(cSVFormat.getQuoteCharacter());
- assertFalse(cSVFormat.getIgnoreEmptyLines());
+ @Test(expected = IllegalArgumentException.class)
+ public void testWithEscapeCRThrowsExceptions() {
+ CSVFormat.DEFAULT.withEscape(CR);
+ }
+ @Test
+ public void testWithFirstRecordAsHeader() throws Exception {
+ final CSVFormat formatWithFirstRecordAsHeader = CSVFormat.DEFAULT.withFirstRecordAsHeader();
+ assertTrue(formatWithFirstRecordAsHeader.getSkipHeaderRecord());
+ assertTrue(formatWithFirstRecordAsHeader.getHeader().length == 0);
}
+ @Test
+ public void testWithHeader() throws Exception {
+ final String[] header = new String[]{"one", "two", "three"};
+ // withHeader() makes a copy of the header array.
+ final CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(header);
+ assertArrayEquals(header, formatWithHeader.getHeader());
+ assertNotSame(header, formatWithHeader.getHeader());
+ }
@Test
public void testWithHeaderComments() {
@@ -845,249 +1024,70 @@ public class CSVFormatTest {
}
-
- @Test //I assume this to be a defect.
- public void testFormatThrowsNullPointerException() {
-
- final CSVFormat cSVFormat = CSVFormat.MYSQL;
-
- try {
- cSVFormat.format(null);
- fail("Expecting exception: NullPointerException");
- } catch(final NullPointerException e) {
- assertEquals(CSVFormat.class.getName(), e.getStackTrace()[0].getClassName());
- }
-
+ @Test
+ public void testWithHeaderEnum() throws Exception {
+ final CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(Header.class);
+ assertArrayEquals(new String[]{ "Name", "Email", "Phone" }, formatWithHeader.getHeader());
}
@Test
- public void testEqualsOne() {
-
- final CSVFormat cSVFormatOne = CSVFormat.INFORMIX_UNLOAD;
- final CSVFormat cSVFormatTwo = CSVFormat.MYSQL;
-
-
- assertEquals('\\', (char)cSVFormatOne.getEscapeCharacter());
- assertNull(cSVFormatOne.getQuoteMode());
-
- assertTrue(cSVFormatOne.getIgnoreEmptyLines());
- assertFalse(cSVFormatOne.getSkipHeaderRecord());
-
- assertFalse(cSVFormatOne.getIgnoreHeaderCase());
- assertNull(cSVFormatOne.getCommentMarker());
-
- assertFalse(cSVFormatOne.isCommentMarkerSet());
- assertTrue(cSVFormatOne.isQuoteCharacterSet());
-
- assertEquals('|', cSVFormatOne.getDelimiter());
- assertFalse(cSVFormatOne.getAllowMissingColumnNames());
-
- assertTrue(cSVFormatOne.isEscapeCharacterSet());
- assertEquals("\n", cSVFormatOne.getRecordSeparator());
-
- assertEquals('\"', (char)cSVFormatOne.getQuoteCharacter());
- assertFalse(cSVFormatOne.getTrailingDelimiter());
-
- assertFalse(cSVFormatOne.getTrim());
- assertFalse(cSVFormatOne.isNullStringSet());
-
- assertNull(cSVFormatOne.getNullString());
- assertFalse(cSVFormatOne.getIgnoreSurroundingSpaces());
-
-
- assertTrue(cSVFormatTwo.isEscapeCharacterSet());
- assertNull(cSVFormatTwo.getQuoteCharacter());
-
- assertFalse(cSVFormatTwo.getAllowMissingColumnNames());
- assertEquals(QuoteMode.ALL_NON_NULL, cSVFormatTwo.getQuoteMode());
-
- assertEquals('\t', cSVFormatTwo.getDelimiter());
- assertEquals("\n", cSVFormatTwo.getRecordSeparator());
-
- assertFalse(cSVFormatTwo.isQuoteCharacterSet());
- assertTrue(cSVFormatTwo.isNullStringSet());
-
- assertEquals('\\', (char)cSVFormatTwo.getEscapeCharacter());
- assertFalse(cSVFormatTwo.getIgnoreHeaderCase());
-
- assertFalse(cSVFormatTwo.getTrim());
- assertFalse(cSVFormatTwo.getIgnoreEmptyLines());
-
- assertEquals("\\N", cSVFormatTwo.getNullString());
- assertFalse(cSVFormatTwo.getIgnoreSurroundingSpaces());
-
- assertFalse(cSVFormatTwo.getTrailingDelimiter());
- assertFalse(cSVFormatTwo.getSkipHeaderRecord());
-
- assertNull(cSVFormatTwo.getCommentMarker());
- assertFalse(cSVFormatTwo.isCommentMarkerSet());
-
- assertNotSame(cSVFormatTwo, cSVFormatOne);
- assertFalse(cSVFormatTwo.equals(cSVFormatOne));
-
- assertEquals('\\', (char)cSVFormatOne.getEscapeCharacter());
- assertNull(cSVFormatOne.getQuoteMode());
-
- assertTrue(cSVFormatOne.getIgnoreEmptyLines());
- assertFalse(cSVFormatOne.getSkipHeaderRecord());
-
- assertFalse(cSVFormatOne.getIgnoreHeaderCase());
- assertNull(cSVFormatOne.getCommentMarker());
-
- assertFalse(cSVFormatOne.isCommentMarkerSet());
- assertTrue(cSVFormatOne.isQuoteCharacterSet());
-
- assertEquals('|', cSVFormatOne.getDelimiter());
- assertFalse(cSVFormatOne.getAllowMissingColumnNames());
-
- assertTrue(cSVFormatOne.isEscapeCharacterSet());
- assertEquals("\n", cSVFormatOne.getRecordSeparator());
-
- assertEquals('\"', (char)cSVFormatOne.getQuoteCharacter());
- assertFalse(cSVFormatOne.getTrailingDelimiter());
-
- assertFalse(cSVFormatOne.getTrim());
- assertFalse(cSVFormatOne.isNullStringSet());
-
- assertNull(cSVFormatOne.getNullString());
- assertFalse(cSVFormatOne.getIgnoreSurroundingSpaces());
-
- assertTrue(cSVFormatTwo.isEscapeCharacterSet());
- assertNull(cSVFormatTwo.getQuoteCharacter());
-
- assertFalse(cSVFormatTwo.getAllowMissingColumnNames());
- assertEquals(QuoteMode.ALL_NON_NULL, cSVFormatTwo.getQuoteMode());
-
- assertEquals('\t', cSVFormatTwo.getDelimiter());
- assertEquals("\n", cSVFormatTwo.getRecordSeparator());
-
- assertFalse(cSVFormatTwo.isQuoteCharacterSet());
- assertTrue(cSVFormatTwo.isNullStringSet());
-
- assertEquals('\\', (char)cSVFormatTwo.getEscapeCharacter());
- assertFalse(cSVFormatTwo.getIgnoreHeaderCase());
-
- assertFalse(cSVFormatTwo.getTrim());
- assertFalse(cSVFormatTwo.getIgnoreEmptyLines());
-
- assertEquals("\\N", cSVFormatTwo.getNullString());
- assertFalse(cSVFormatTwo.getIgnoreSurroundingSpaces());
-
- assertFalse(cSVFormatTwo.getTrailingDelimiter());
- assertFalse(cSVFormatTwo.getSkipHeaderRecord());
-
- assertNull(cSVFormatTwo.getCommentMarker());
- assertFalse(cSVFormatTwo.isCommentMarkerSet());
-
- assertNotSame(cSVFormatOne, cSVFormatTwo);
- assertNotSame(cSVFormatTwo, cSVFormatOne);
-
- assertFalse(cSVFormatOne.equals(cSVFormatTwo));
- assertFalse(cSVFormatTwo.equals(cSVFormatOne));
-
- assertFalse(cSVFormatTwo.equals(cSVFormatOne));
-
+ public void testWithIgnoreEmptyLines() throws Exception {
+ assertFalse(CSVFormat.DEFAULT.withIgnoreEmptyLines(false).getIgnoreEmptyLines());
+ assertTrue(CSVFormat.DEFAULT.withIgnoreEmptyLines().getIgnoreEmptyLines());
}
@Test
- public void testEqualsWithNull() {
-
- final CSVFormat cSVFormat = CSVFormat.POSTGRESQL_TEXT;
-
- assertEquals('\"', (char)cSVFormat.getEscapeCharacter());
- assertFalse(cSVFormat.getIgnoreSurroundingSpaces());
-
- assertFalse(cSVFormat.getTrailingDelimiter());
- assertFalse(cSVFormat.getTrim());
-
- assertTrue(cSVFormat.isQuoteCharacterSet());
- assertEquals("\\N", cSVFormat.getNullString());
-
- assertFalse(cSVFormat.getIgnoreHeaderCase());
- assertTrue(cSVFormat.isEscapeCharacterSet());
-
- assertFalse(cSVFormat.isCommentMarkerSet());
- assertNull(cSVFormat.getCommentMarker());
-
- assertFalse(cSVFormat.getAllowMissingColumnNames());
- assertEquals(QuoteMode.ALL_NON_NULL, cSVFormat.getQuoteMode());
-
- assertEquals('\t', cSVFormat.getDelimiter());
- assertFalse(cSVFormat.getSkipHeaderRecord());
-
- assertEquals("\n", cSVFormat.getRecordSeparator());
- assertFalse(cSVFormat.getIgnoreEmptyLines());
-
- assertEquals('\"', (char)cSVFormat.getQuoteCharacter());
- assertTrue(cSVFormat.isNullStringSet());
-
- assertEquals('\"', (char)cSVFormat.getEscapeCharacter());
- assertFalse(cSVFormat.getIgnoreSurroundingSpaces());
-
- assertFalse(cSVFormat.getTrailingDelimiter());
- assertFalse(cSVFormat.getTrim());
-
- assertTrue(cSVFormat.isQuoteCharacterSet());
- assertEquals("\\N", cSVFormat.getNullString());
-
- assertFalse(cSVFormat.getIgnoreHeaderCase());
- assertTrue(cSVFormat.isEscapeCharacterSet());
-
- assertFalse(cSVFormat.isCommentMarkerSet());
- assertNull(cSVFormat.getCommentMarker());
-
- assertFalse(cSVFormat.getAllowMissingColumnNames());
- assertEquals(QuoteMode.ALL_NON_NULL, cSVFormat.getQuoteMode());
-
- assertEquals('\t', cSVFormat.getDelimiter());
- assertFalse(cSVFormat.getSkipHeaderRecord());
-
- assertEquals("\n", cSVFormat.getRecordSeparator());
- assertFalse(cSVFormat.getIgnoreEmptyLines());
+ public void testWithIgnoreSurround() throws Exception {
+ assertFalse(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(false).getIgnoreSurroundingSpaces());
+ assertTrue(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces().getIgnoreSurroundingSpaces());
+ }
- assertEquals('\"', (char)cSVFormat.getQuoteCharacter());
- assertTrue(cSVFormat.isNullStringSet());
-
- assertFalse(cSVFormat.equals( null));
+ @Test
+ public void testWithNullString() throws Exception {
+ final CSVFormat formatWithNullString = CSVFormat.DEFAULT.withNullString("null");
+ assertEquals("null", formatWithNullString.getNullString());
}
@Test
- public void testToString() {
-
- final CSVFormat cSVFormat = CSVFormat.POSTGRESQL_TEXT;
- final String string = cSVFormat.INFORMIX_UNLOAD.toString();
+ public void testWithQuoteChar() throws Exception {
+ final CSVFormat formatWithQuoteChar = CSVFormat.DEFAULT.withQuote('"');
+ assertEquals(Character.valueOf('"'), formatWithQuoteChar.getQuoteCharacter());
+ }
- assertEquals("Delimiter=<|> Escape=<\\> QuoteChar=<\"> RecordSeparator=<\n> EmptyLines:ignored SkipHeaderRecord:false", string);
+ @Test(expected = IllegalArgumentException.class)
+ public void testWithQuoteLFThrowsException() {
+ CSVFormat.DEFAULT.withQuote(LF);
}
@Test
- public void testHashCodeAndWithIgnoreHeaderCase() {
-
- final CSVFormat cSVFormat = CSVFormat.INFORMIX_UNLOAD_CSV;
- final CSVFormat cSVFormatTwo = cSVFormat.withIgnoreHeaderCase();
- cSVFormatTwo.hashCode();
-
- assertTrue(cSVFormatTwo.getIgnoreHeaderCase());
- assertFalse(cSVFormatTwo.getTrailingDelimiter());
-
- assertTrue(cSVFormatTwo.equals(cSVFormat));
- assertFalse(cSVFormatTwo.getAllowMissingColumnNames());
+ public void testWithQuotePolicy() throws Exception {
+ final CSVFormat formatWithQuotePolicy = CSVFormat.DEFAULT.withQuoteMode(QuoteMode.ALL);
+ assertEquals(QuoteMode.ALL, formatWithQuotePolicy.getQuoteMode());
+ }
- assertFalse(cSVFormatTwo.getTrim());
+ @Test
+ public void testWithRecordSeparatorCR() throws Exception {
+ final CSVFormat formatWithRecordSeparator = CSVFormat.DEFAULT.withRecordSeparator(CR);
+ assertEquals(String.valueOf(CR), formatWithRecordSeparator.getRecordSeparator());
}
- public enum Header {
- Name, Email, Phone
+ @Test
+ public void testWithRecordSeparatorCRLF() throws Exception {
+ final CSVFormat formatWithRecordSeparator = CSVFormat.DEFAULT.withRecordSeparator(CRLF);
+ assertEquals(CRLF, formatWithRecordSeparator.getRecordSeparator());
}
- public enum EmptyEnum {
+ @Test
+ public void testWithRecordSeparatorLF() throws Exception {
+ final CSVFormat formatWithRecordSeparator = CSVFormat.DEFAULT.withRecordSeparator(LF);
+ assertEquals(String.valueOf(LF), formatWithRecordSeparator.getRecordSeparator());
}
}
[16/34] commons-csv git commit: Next version will be 1.6 due to new
auto-flush feature just added.
Posted by st...@apache.org.
Next version will be 1.6 due to new auto-flush feature just added.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/9c203414
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/9c203414
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/9c203414
Branch: refs/heads/CSV-216
Commit: 9c203414696118e291279ff3a2eb22221d58b93d
Parents: 7e47152
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Oct 9 13:23:46 2017 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Oct 9 13:23:46 2017 -0600
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/9c203414/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8b13c17..0feb5be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<version>42</version>
</parent>
<artifactId>commons-csv</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6-SNAPSHOT</version>
<name>Apache Commons CSV</name>
<url>http://commons.apache.org/proper/commons-csv/</url>
<description>
[03/34] commons-csv git commit: Add missing CSV test files to RAT
report exclusions list
Posted by st...@apache.org.
Add missing CSV test files to RAT report exclusions list
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/9d2b6d75
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/9d2b6d75
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/9d2b6d75
Branch: refs/heads/CSV-216
Commit: 9d2b6d75c8af5678538b03db8b615f0ce46e5763
Parents: f7d7d63
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sun Aug 27 10:31:03 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Aug 27 10:31:03 2017 +1200
----------------------------------------------------------------------
pom.xml | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/9d2b6d75/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2af9ee1..e05d463 100644
--- a/pom.xml
+++ b/pom.xml
@@ -331,6 +331,8 @@ CSV files of various types.
<configuration>
<excludes>
<exclude>src/test/resources/csv-167/sample1.csv</exclude>
+ <exclude>src/test/resources/CSV-198/optd_por_public.csv</exclude>
+ <exclude>src/test/resources/CSV-213/999751170.patch.csv</exclude>
<exclude>src/test/resources/CSVFileParser/bom.csv</exclude>
<exclude>src/test/resources/CSVFileParser/test.csv</exclude>
<exclude>src/test/resources/CSVFileParser/test_default.txt</exclude>
[15/34] commons-csv git commit: [CSV-217] Add autoFlush option for
CsvPrinter. Applying modified patch This closes #24.
Posted by st...@apache.org.
[CSV-217] Add autoFlush option for CsvPrinter. Applying modified patch
This closes #24.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/7e471527
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/7e471527
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/7e471527
Branch: refs/heads/CSV-216
Commit: 7e471527915cb0c73316c598fd02b71a56f2cf43
Parents: 10977ae
Author: Korolyov Alexei <al...@yandex.ru>
Authored: Mon Oct 9 13:22:53 2017 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Oct 9 13:22:53 2017 -0600
----------------------------------------------------------------------
pom.xml | 6 ++
src/changes/changes.xml | 1 +
.../java/org/apache/commons/csv/CSVFormat.java | 75 ++++++++++++++------
.../java/org/apache/commons/csv/CSVPrinter.java | 17 +++++
.../org/apache/commons/csv/CSVPrinterTest.java | 55 ++++++++++++++
5 files changed, 131 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/7e471527/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 262bc17..8b13c17 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,6 +39,12 @@ CSV files of various types.
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/7e471527/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bbfa930..b56b75f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -39,6 +39,7 @@
</properties>
<body>
<release version="1.6" date="2017-MM-DD" description="Feature and bug fix release">
+ <action issue="CSV-217" type="add" dev="ggregory" due-to="Korolyov Alexei">Add autoFlush option for CsvPrinter. PR #24.</action>
</release>
<release version="1.5" date="2017-09-03" description="Feature and bug fix release">
<action issue="CSV-203" type="fix" dev="ggregory" due-to="Richard Wheeldon, Kai Paroth">withNullString value is printed without quotes when QuoteMode.ALL is specified; add QuoteMode.ALL_NON_NULL. PR #17.</action>
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/7e471527/src/main/java/org/apache/commons/csv/CSVFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index 410c8fb..29b7c36 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -242,7 +242,7 @@ public final class CSVFormat implements Serializable {
* @see Predefined#Default
*/
public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null, false, true, CRLF,
- null, null, null, false, false, false, false, false);
+ null, null, null, false, false, false, false, false, false);
/**
* Excel file format (using a comma as the value delimiter). Note that the actual value delimiter used by Excel is
@@ -537,7 +537,7 @@ public final class CSVFormat implements Serializable {
*/
public static CSVFormat newFormat(final char delimiter) {
return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, null, false, false,
- false, false, false);
+ false, false, false, false);
}
/**
@@ -584,6 +584,8 @@ public final class CSVFormat implements Serializable {
private final boolean trim;
+ private final boolean autoFlush;
+
/**
* Creates a customized CSV format.
*
@@ -619,15 +621,16 @@ public final class CSVFormat implements Serializable {
* TODO
* @param trailingDelimiter
* TODO
+ * @param autoFlush
* @throws IllegalArgumentException
* if the delimiter is a line break character
*/
private CSVFormat(final char delimiter, final Character quoteChar, final QuoteMode quoteMode,
- final Character commentStart, final Character escape, final boolean ignoreSurroundingSpaces,
- final boolean ignoreEmptyLines, final String recordSeparator, final String nullString,
- final Object[] headerComments, final String[] header, final boolean skipHeaderRecord,
- final boolean allowMissingColumnNames, final boolean ignoreHeaderCase, final boolean trim,
- final boolean trailingDelimiter) {
+ final Character commentStart, final Character escape, final boolean ignoreSurroundingSpaces,
+ final boolean ignoreEmptyLines, final String recordSeparator, final String nullString,
+ final Object[] headerComments, final String[] header, final boolean skipHeaderRecord,
+ final boolean allowMissingColumnNames, final boolean ignoreHeaderCase, final boolean trim,
+ final boolean trailingDelimiter, boolean autoFlush) {
this.delimiter = delimiter;
this.quoteCharacter = quoteChar;
this.quoteMode = quoteMode;
@@ -644,6 +647,7 @@ public final class CSVFormat implements Serializable {
this.ignoreHeaderCase = ignoreHeaderCase;
this.trailingDelimiter = trailingDelimiter;
this.trim = trim;
+ this.autoFlush = autoFlush;
validate();
}
@@ -887,6 +891,16 @@ public final class CSVFormat implements Serializable {
return trim;
}
+ /**
+ * Returns whether to flush on close.
+ *
+ * @return whether to flush on close.
+ * @since 1.6
+ */
+ public boolean getAutoFlush() {
+ return autoFlush;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
@@ -1431,7 +1445,7 @@ public final class CSVFormat implements Serializable {
public CSVFormat withAllowMissingColumnNames(final boolean allowMissingColumnNames) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1466,7 +1480,7 @@ public final class CSVFormat implements Serializable {
}
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1484,7 +1498,7 @@ public final class CSVFormat implements Serializable {
}
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1515,7 +1529,7 @@ public final class CSVFormat implements Serializable {
}
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escape, ignoreSurroundingSpaces,
ignoreEmptyLines, recordSeparator, nullString, headerComments, header, skipHeaderRecord,
- allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1670,7 +1684,7 @@ public final class CSVFormat implements Serializable {
public CSVFormat withHeader(final String... header) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1691,7 +1705,7 @@ public final class CSVFormat implements Serializable {
public CSVFormat withHeaderComments(final Object... headerComments) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1716,7 +1730,7 @@ public final class CSVFormat implements Serializable {
public CSVFormat withIgnoreEmptyLines(final boolean ignoreEmptyLines) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1742,7 +1756,7 @@ public final class CSVFormat implements Serializable {
public CSVFormat withIgnoreHeaderCase(final boolean ignoreHeaderCase) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1767,7 +1781,7 @@ public final class CSVFormat implements Serializable {
public CSVFormat withIgnoreSurroundingSpaces(final boolean ignoreSurroundingSpaces) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1786,7 +1800,7 @@ public final class CSVFormat implements Serializable {
public CSVFormat withNullString(final String nullString) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1817,7 +1831,7 @@ public final class CSVFormat implements Serializable {
}
return new CSVFormat(delimiter, quoteChar, quoteMode, commentMarker, escapeCharacter, ignoreSurroundingSpaces,
ignoreEmptyLines, recordSeparator, nullString, headerComments, header, skipHeaderRecord,
- allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1831,7 +1845,7 @@ public final class CSVFormat implements Serializable {
public CSVFormat withQuoteMode(final QuoteMode quoteModePolicy) {
return new CSVFormat(delimiter, quoteCharacter, quoteModePolicy, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1869,7 +1883,7 @@ public final class CSVFormat implements Serializable {
public CSVFormat withRecordSeparator(final String recordSeparator) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1896,7 +1910,7 @@ public final class CSVFormat implements Serializable {
public CSVFormat withSkipHeaderRecord(final boolean skipHeaderRecord) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1921,7 +1935,7 @@ public final class CSVFormat implements Serializable {
public CSVFormat withTrailingDelimiter(final boolean trailingDelimiter) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
/**
@@ -1946,6 +1960,21 @@ public final class CSVFormat implements Serializable {
public CSVFormat withTrim(final boolean trim) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
+ }
+
+ /**
+ * Returns a new {@code CSVFormat} with whether to flush on close.
+ *
+ * @param autoFlush
+ * whether to flush on close.
+ *
+ * @return A new CSVFormat that is equal to this but with the specified autoFlush setting.
+ * @since 1.6
+ */
+ public CSVFormat withAutoFlush(final boolean autoFlush) {
+ return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
+ ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
}
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/7e471527/src/main/java/org/apache/commons/csv/CSVPrinter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVPrinter.java b/src/main/java/org/apache/commons/csv/CSVPrinter.java
index 96b24a4..49d9022 100644
--- a/src/main/java/org/apache/commons/csv/CSVPrinter.java
+++ b/src/main/java/org/apache/commons/csv/CSVPrinter.java
@@ -81,6 +81,23 @@ public final class CSVPrinter implements Flushable, Closeable {
@Override
public void close() throws IOException {
+ close(false);
+ }
+
+ /**
+ * Closes the underlying stream with an optional flush first.
+ * @param flush whether to flush before the actual close.
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ * @since 1.6
+ */
+ public void close(boolean flush) throws IOException {
+ if (flush || format.getAutoFlush()) {
+ if (out instanceof Flushable) {
+ ((Flushable) out).flush();
+ }
+ }
if (out instanceof Closeable) {
((Closeable) out).close();
}
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/7e471527/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
index 4a0ffbf..893675c 100644
--- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
@@ -21,12 +21,17 @@ import static org.apache.commons.csv.Constants.CR;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import java.io.CharArrayWriter;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
+import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.sql.BatchUpdateException;
@@ -1311,4 +1316,54 @@ public class CSVPrinterTest {
}
}
+ @Test
+ public void testCloseWithFlushOn() throws IOException {
+ Writer writer = mock(Writer.class);
+ CSVFormat csvFormat = CSVFormat.DEFAULT;
+ CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat);
+ csvPrinter.close(true);
+ verify(writer, times(1)).flush();
+ }
+
+ @Test
+ public void testCloseWithFlushOff() throws IOException {
+ Writer writer = mock(Writer.class);
+ CSVFormat csvFormat = CSVFormat.DEFAULT;
+ CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat);
+ csvPrinter.close(false);
+ verify(writer, never()).flush();
+ verify(writer, times(1)).close();
+ }
+
+ @Test
+ public void testCloseBackwardCompatibility() throws IOException {
+ Writer writer = mock(Writer.class);
+ CSVFormat csvFormat = CSVFormat.DEFAULT;
+ try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
+ }
+ verify(writer, never()).flush();
+ verify(writer, times(1)).close();
+ }
+
+ @Test
+ public void testCloseWithCsvFormatAutoFlushOn() throws IOException {
+ System.out.println("start method");
+ Writer writer = mock(Writer.class);
+ CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(true);
+ try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
+ }
+ verify(writer, times(1)).flush();
+ verify(writer, times(1)).close();
+ }
+
+ @Test
+ public void testCloseWithCsvFormatAutoFlushOff() throws IOException {
+ Writer writer = mock(Writer.class);
+ CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(false);
+ try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
+ }
+ verify(writer, never()).flush();
+ verify(writer, times(1)).close();
+ }
+
}
[32/34] commons-csv git commit: Update to commons-parent version 43
Posted by st...@apache.org.
Update to commons-parent version 43
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/f3f48be1
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/f3f48be1
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/f3f48be1
Branch: refs/heads/CSV-216
Commit: f3f48be1d08d87672aa80364f1d59df3daa11be1
Parents: 3a20344
Author: pascalschumacher <pa...@gmx.net>
Authored: Sun Jan 7 11:42:26 2018 +0100
Committer: pascalschumacher <pa...@gmx.net>
Committed: Sun Jan 7 11:42:26 2018 +0100
----------------------------------------------------------------------
pom.xml | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/f3f48be1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 68fb8e2..3beeffc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.apache.commons</groupId>
<artifactId>commons-parent</artifactId>
- <version>42</version>
+ <version>43</version>
</parent>
<artifactId>commons-csv</artifactId>
<version>1.6-SNAPSHOT</version>
@@ -152,9 +152,6 @@ CSV files of various types.
<checkstyle.version>2.17</checkstyle.version>
<checkstyle.header.file>${basedir}/LICENSE-header.txt</checkstyle.header.file>
<checkstyle.resourceExcludes>LICENSE.txt, NOTICE.txt</checkstyle.resourceExcludes>
-
- <!-- Override jacoco version for java 9 compatibility -->
- <commons.jacoco.version>0.7.9</commons.jacoco.version>
</properties>
<build>
@@ -274,7 +271,6 @@ CSV files of various types.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
- <version>3.0.5</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -522,8 +518,6 @@ CSV files of various types.
<jdk>9</jdk>
</activation>
<properties>
- <!-- versions below 3.0.0 do not work with java 9 -->
- <commons.javadoc.version>3.0.0-M1</commons.javadoc.version>
<!-- coverall version 4.3.0 does not work with java 9, see https://github.com/trautonen/coveralls-maven-plugin/issues/112 -->
<coveralls.skip>true</coveralls.skip>
</properties>
[34/34] commons-csv git commit: Merge branch 'master' into CSV-216
Posted by st...@apache.org.
Merge branch 'master' into CSV-216
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/d482fd28
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/d482fd28
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/d482fd28
Branch: refs/heads/CSV-216
Commit: d482fd289ce446afb73a332cf52802fb16d0ddce
Parents: 41101f1 eede739
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri Feb 9 14:19:48 2018 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri Feb 9 14:19:48 2018 +0000
----------------------------------------------------------------------
.travis.yml | 1 +
CONTRIBUTING.md | 40 +-
NOTICE.txt | 2 +-
README.md | 22 +-
RELEASE-NOTES.txt | 57 ++
pom.xml | 30 +-
src/changes/changes.xml | 8 +-
.../java/org/apache/commons/csv/CSVFormat.java | 210 +++--
.../java/org/apache/commons/csv/CSVParser.java | 5 +-
.../java/org/apache/commons/csv/CSVPrinter.java | 17 +
src/main/java/org/apache/commons/csv/Lexer.java | 2 +-
.../java/org/apache/commons/csv/QuoteMode.java | 11 +-
src/site/site.xml | 1 +
src/site/xdoc/download_csv.xml | 26 +-
src/site/xdoc/index.xml | 6 +-
.../org/apache/commons/csv/CSVFormatTest.java | 836 ++++++++++---------
.../org/apache/commons/csv/CSVParserTest.java | 2 +-
.../org/apache/commons/csv/CSVPrinterTest.java | 108 ++-
.../commons/csv/issues/JiraCsv198Test.java | 6 +-
.../commons/csv/issues/JiraCsv203Test.java | 42 +-
.../commons/csv/issues/JiraCsv213Test.java | 6 +-
21 files changed, 837 insertions(+), 601 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/d482fd28/src/main/java/org/apache/commons/csv/CSVFormat.java
----------------------------------------------------------------------
diff --cc src/main/java/org/apache/commons/csv/CSVFormat.java
index bdac8e3,10f766d..e53e3b6
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@@ -242,7 -242,7 +242,7 @@@ public final class CSVFormat implement
* @see Predefined#Default
*/
public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null, false, true, CRLF,
-- null, null, null, false, false, false, false, false, false);
++ null, null, null, false, false, false, false, false, false, false);
/**
* Excel file format (using a comma as the value delimiter). Note that the actual value delimiter used by Excel is
@@@ -537,7 -537,7 +537,7 @@@
*/
public static CSVFormat newFormat(final char delimiter) {
return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, null, false, false,
-- false, false, false, false);
++ false, false, false, false, false);
}
/**
@@@ -621,16 -621,16 +623,19 @@@
* TODO
* @param trailingDelimiter
* TODO
+ * @param mutableRecords TODO
+ * @param autoFlush
++ * TODO
++ *
* @throws IllegalArgumentException
* if the delimiter is a line break character
*/
private CSVFormat(final char delimiter, final Character quoteChar, final QuoteMode quoteMode,
- final Character commentStart, final Character escape, final boolean ignoreSurroundingSpaces,
- final boolean ignoreEmptyLines, final String recordSeparator, final String nullString,
- final Object[] headerComments, final String[] header, final boolean skipHeaderRecord,
- final boolean allowMissingColumnNames, final boolean ignoreHeaderCase, final boolean trim,
- final boolean trailingDelimiter, final boolean autoFlush) {
+ final Character commentStart, final Character escape, final boolean ignoreSurroundingSpaces,
+ final boolean ignoreEmptyLines, final String recordSeparator, final String nullString,
+ final Object[] headerComments, final String[] header, final boolean skipHeaderRecord,
+ final boolean allowMissingColumnNames, final boolean ignoreHeaderCase, final boolean trim,
- final boolean trailingDelimiter, boolean mutableRecords) {
++ final boolean trailingDelimiter, final boolean autoFlush, final boolean mutableRecords) {
this.delimiter = delimiter;
this.quoteCharacter = quoteChar;
this.quoteMode = quoteMode;
@@@ -647,7 -647,7 +652,8 @@@
this.ignoreHeaderCase = ignoreHeaderCase;
this.trailingDelimiter = trailingDelimiter;
this.trim = trim;
+ this.mutableRecords = mutableRecords;
+ this.autoFlush = autoFlush;
validate();
}
@@@ -1439,7 -1442,22 +1452,22 @@@
public CSVFormat withAllowMissingColumnNames(final boolean allowMissingColumnNames) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
+ }
+
+ /**
+ * Returns a new {@code CSVFormat} with whether to flush on close.
+ *
+ * @param autoFlush
+ * whether to flush on close.
+ *
+ * @return A new CSVFormat that is equal to this but with the specified autoFlush setting.
+ * @since 1.6
+ */
+ public CSVFormat withAutoFlush(final boolean autoFlush) {
+ return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
+ ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1474,7 -1492,7 +1502,7 @@@
}
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1492,7 -1510,7 +1520,7 @@@
}
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1523,7 -1541,7 +1551,7 @@@
}
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escape, ignoreSurroundingSpaces,
ignoreEmptyLines, recordSeparator, nullString, headerComments, header, skipHeaderRecord,
- allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1678,7 -1696,7 +1706,7 @@@
public CSVFormat withHeader(final String... header) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1699,7 -1717,7 +1727,7 @@@
public CSVFormat withHeaderComments(final Object... headerComments) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1724,7 -1742,7 +1752,7 @@@
public CSVFormat withIgnoreEmptyLines(final boolean ignoreEmptyLines) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1750,7 -1768,7 +1778,7 @@@
public CSVFormat withIgnoreHeaderCase(final boolean ignoreHeaderCase) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1775,25 -1793,7 +1803,25 @@@
public CSVFormat withIgnoreSurroundingSpaces(final boolean ignoreSurroundingSpaces) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
+ }
+
+ /**
+ * Returns a new {@code CSVFormat} with whether to generate CSVRecord or CSVMutableRecord.
+ * <ul>
+ * <li><strong>Reading:</strong> Whether to generate CSVRecord or CSVMutableRecord.</li>
+ * <li><strong>Writing:</strong> No effect.</li>
+ * </ul>
+ *
+ * @param mutableRecords
+ * whether to generate CSVRecord or CSVMutableRecord
+ *
+ * @return A new CSVFormat that is equal to this but with setting to generate CSVRecord or CSVMutableRecord.
+ */
+ public CSVFormat withMutableRecords(final boolean mutableRecords) {
+ return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
+ ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1812,7 -1812,7 +1840,7 @@@
public CSVFormat withNullString(final String nullString) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1843,7 -1843,7 +1871,7 @@@
}
return new CSVFormat(delimiter, quoteChar, quoteMode, commentMarker, escapeCharacter, ignoreSurroundingSpaces,
ignoreEmptyLines, recordSeparator, nullString, headerComments, header, skipHeaderRecord,
- allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1857,7 -1857,7 +1885,7 @@@
public CSVFormat withQuoteMode(final QuoteMode quoteModePolicy) {
return new CSVFormat(delimiter, quoteCharacter, quoteModePolicy, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1895,7 -1895,7 +1923,7 @@@
public CSVFormat withRecordSeparator(final String recordSeparator) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1922,7 -1922,23 +1950,23 @@@
public CSVFormat withSkipHeaderRecord(final boolean skipHeaderRecord) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
+ }
+
+ /**
+ * Returns a new {@code CSVFormat} with the record separator of the format set to the operating system's line
+ * separator string, typically CR+LF on Windows and LF on Linux.
+ *
+ * <p>
+ * <strong>Note:</strong> This setting is only used during printing and does not affect parsing. Parsing currently
+ * only works for inputs with '\n', '\r' and "\r\n"
+ * </p>
+ *
- * @return A new CSVFormat that is equal to this but with the operating system's line separator stringr
++ * @return A new CSVFormat that is equal to this but with the operating system's line separator string
+ * @since 1.6
+ */
+ public CSVFormat withSystemRecordSeparator() {
+ return withRecordSeparator(System.getProperty("line.separator"));
}
/**
@@@ -1947,7 -1963,7 +1991,7 @@@
public CSVFormat withTrailingDelimiter(final boolean trailingDelimiter) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
/**
@@@ -1972,7 -1988,6 +2016,7 @@@
public CSVFormat withTrim(final boolean trim) {
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, mutableRecords);
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
++ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush, mutableRecords);
}
+
}
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/d482fd28/src/main/java/org/apache/commons/csv/CSVParser.java
----------------------------------------------------------------------
[14/34] commons-csv git commit: Add version 1.6 to changes.
Posted by st...@apache.org.
Add version 1.6 to changes.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/10977ae1
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/10977ae1
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/10977ae1
Branch: refs/heads/CSV-216
Commit: 10977ae1b2e50d3b347d9fe501c4e40a7dccd94e
Parents: edb87f3
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Oct 9 13:10:23 2017 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Oct 9 13:10:23 2017 -0600
----------------------------------------------------------------------
src/changes/changes.xml | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/10977ae1/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 039d15f..bbfa930 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -38,6 +38,8 @@
<title>Release Notes</title>
</properties>
<body>
+ <release version="1.6" date="2017-MM-DD" description="Feature and bug fix release">
+ </release>
<release version="1.5" date="2017-09-03" description="Feature and bug fix release">
<action issue="CSV-203" type="fix" dev="ggregory" due-to="Richard Wheeldon, Kai Paroth">withNullString value is printed without quotes when QuoteMode.ALL is specified; add QuoteMode.ALL_NON_NULL. PR #17.</action>
<action issue="CSV-194" type="fix" dev="ggregory" due-to="Marc Prud'hommeaux">Fix outdated comments about FileReader in CSVParser #13</action>
[18/34] commons-csv git commit: Next version will be 1.6 due to new
auto-flush feature just added.
Posted by st...@apache.org.
Next version will be 1.6 due to new auto-flush feature just added.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/5ca0f91f
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/5ca0f91f
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/5ca0f91f
Branch: refs/heads/CSV-216
Commit: 5ca0f91ff65440476239d67dd31da9556da1bd88
Parents: 3c0a73b
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Oct 9 13:25:13 2017 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Oct 9 13:25:13 2017 -0600
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/5ca0f91f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0feb5be..a9777da 100644
--- a/pom.xml
+++ b/pom.xml
@@ -134,7 +134,7 @@ CSV files of various types.
</distributionManagement>
<properties>
- <commons.release.version>1.5</commons.release.version>
+ <commons.release.version>1.6</commons.release.version>
<commons.release.desc>(Java 7+)</commons.release.desc>
<!-- The RC version used in the staging repository URL. -->
<commons.rc.version>RC1</commons.rc.version>
[31/34] commons-csv git commit: [CSV-220] Add API
org.apache.commons.csv.CSVFormat.withSystemRecordSeparator().
Posted by st...@apache.org.
[CSV-220] Add API
org.apache.commons.csv.CSVFormat.withSystemRecordSeparator().
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/3a203443
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/3a203443
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/3a203443
Branch: refs/heads/CSV-216
Commit: 3a2034434cf29e241378f5f0cdbb9be6cf01eaba
Parents: 34262e8
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Dec 11 11:50:31 2017 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Dec 11 11:50:31 2017 -0700
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/csv/CSVFormat.java | 16 ++++++++++++++++
.../java/org/apache/commons/csv/CSVFormatTest.java | 8 +++++++-
3 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/3a203443/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 302632e..217c2ce 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -42,6 +42,7 @@
<action issue="CSV-217" type="add" dev="ggregory" due-to="Korolyov Alexei">Add autoFlush option for CsvPrinter. PR #24.</action>
<action issue="CSV-219" type="fix" dev="ggregory" due-to="Zhang Hongda">The behavior of quote char using is not similar as Excel does when the first string contains CJK char(s).</action>
<action issue="CSV-172" type="fix" dev="ggregory" due-to="Andrew Pennebaker">Don't quote cells just because they have UTF-8 encoded characters.</action>
+ <action issue="CSV-220" type="add" dev="ggregory" due-to="Gary Gregory">Add API org.apache.commons.csv.CSVFormat.withSystemRecordSeparator().</action>
</release>
<release version="1.5" date="2017-09-03" description="Feature and bug fix release">
<action issue="CSV-203" type="fix" dev="ggregory" due-to="Richard Wheeldon, Kai Paroth">withNullString value is printed without quotes when QuoteMode.ALL is specified; add QuoteMode.ALL_NON_NULL. PR #17.</action>
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/3a203443/src/main/java/org/apache/commons/csv/CSVFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index 9e6c807..10f766d 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -1926,6 +1926,22 @@ public final class CSVFormat implements Serializable {
}
/**
+ * Returns a new {@code CSVFormat} with the record separator of the format set to the operating system's line
+ * separator string, typically CR+LF on Windows and LF on Linux.
+ *
+ * <p>
+ * <strong>Note:</strong> This setting is only used during printing and does not affect parsing. Parsing currently
+ * only works for inputs with '\n', '\r' and "\r\n"
+ * </p>
+ *
+ * @return A new CSVFormat that is equal to this but with the operating system's line separator stringr
+ * @since 1.6
+ */
+ public CSVFormat withSystemRecordSeparator() {
+ return withRecordSeparator(System.getProperty("line.separator"));
+ }
+
+ /**
* Returns a new {@code CSVFormat} to add a trailing delimiter.
*
* @return A new CSVFormat that is equal to this but with the trailing delimiter setting.
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/3a203443/src/test/java/org/apache/commons/csv/CSVFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/csv/CSVFormatTest.java b/src/test/java/org/apache/commons/csv/CSVFormatTest.java
index 9a69780..6a96c7c 100644
--- a/src/test/java/org/apache/commons/csv/CSVFormatTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVFormatTest.java
@@ -640,7 +640,7 @@ public class CSVFormatTest {
public void testToString() {
final CSVFormat cSVFormat = CSVFormat.POSTGRESQL_TEXT;
- final String string = cSVFormat.INFORMIX_UNLOAD.toString();
+ final String string = CSVFormat.INFORMIX_UNLOAD.toString();
assertEquals("Delimiter=<|> Escape=<\\> QuoteChar=<\"> RecordSeparator=<\n> EmptyLines:ignored SkipHeaderRecord:false", string);
@@ -1090,4 +1090,10 @@ public class CSVFormatTest {
assertEquals(String.valueOf(LF), formatWithRecordSeparator.getRecordSeparator());
}
+ @Test
+ public void testWithSystemRecordSeparator() throws Exception {
+ final CSVFormat formatWithRecordSeparator = CSVFormat.DEFAULT.withSystemRecordSeparator();
+ assertEquals(System.getProperty("line.separator"), formatWithRecordSeparator.getRecordSeparator());
+ }
+
}
[11/34] commons-csv git commit: Updated site in preparation for 1.5
release
Posted by st...@apache.org.
Updated site in preparation for 1.5 release
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/f76a1357
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/f76a1357
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/f76a1357
Branch: refs/heads/CSV-216
Commit: f76a1357057cd3caaf9b0904d9cc57ce384658a3
Parents: 3894acc
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sun Aug 27 10:49:46 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Aug 27 10:51:00 2017 +1200
----------------------------------------------------------------------
src/site/site.xml | 1 +
src/site/xdoc/index.xml | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/f76a1357/src/site/site.xml
----------------------------------------------------------------------
diff --git a/src/site/site.xml b/src/site/site.xml
index 1618024..25165bc 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -40,6 +40,7 @@
<item name="Team" href="/team-list.html"/>
<item name="Source Repository" href="/source-repository.html"/>
<item name="Javadoc trunk" href="/apidocs/index.html"/>
+ <item name="Javadoc 1.5" href="/archives/1.5/apidocs/index.html"/>
<item name="Javadoc 1.4" href="/archives/1.4/apidocs/index.html"/>
<item name="Javadoc 1.3" href="/archives/1.3/apidocs/index.html"/>
<item name="Javadoc 1.2" href="/archives/1.2/apidocs/index.html"/>
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/f76a1357/src/site/xdoc/index.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 3238804..f9a07ba 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -48,6 +48,7 @@ The Javadoc API documents are available online:
</p>
<ul>
<li><a href="apidocs/index.html">Javadoc trunk</a></li>
+ <li><a href="archives/1.5/apidocs/index.html">Javadoc 1.5</a></li>
<li><a href="archives/1.4/apidocs/index.html">Javadoc 1.4</a></li>
<li><a href="archives/1.3/apidocs/index.html">Javadoc 1.3</a></li>
<li><a href="archives/1.2/apidocs/index.html">Javadoc 1.2</a></li>
@@ -62,7 +63,8 @@ The <a href="source-repository.html">git repository</a> can be
<!-- ================================================== -->
<section name="Releases">
<ul>
- <li><a href="http://commons.apache.org/csv/download_csv.cgi">Apache Commons CSV 1.4 (mirrors)</a> requires Java 1.6</li>
+ <li><a href="http://commons.apache.org/csv/download_csv.cgi">Apache Commons CSV 1.5 (mirrors)</a> requires Java 1.7</li>
+ <li><a href="http://commons.apache.org/dist/commons/csv/">Apache Commons CSV 1.4 (archives)</a> requires Java 1.6</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.3 (archives)</a> requires Java 1.6</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.2 (archives)</a> requires Java 1.6</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.1 (archives)</a> requires Java 1.6</li>
@@ -84,7 +86,7 @@ For previous releases, see the <a href="http://archive.apache.org/dist/commons/c
<pre><dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
- <version>1.3</version>
+ <version>1.5</version>
</dependency></pre>
</p>
<p>
[12/34] commons-csv git commit: Bump to next development version
Posted by st...@apache.org.
Bump to next development version
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/3e3c2365
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/3e3c2365
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/3e3c2365
Branch: refs/heads/CSV-216
Commit: 3e3c236562ed3c520f70bb0cfeec9c8587fd9481
Parents: f76a135
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sun Sep 3 17:26:46 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Sep 3 17:26:46 2017 +1200
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/3e3c2365/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 232a5de..262bc17 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<version>42</version>
</parent>
<artifactId>commons-csv</artifactId>
- <version>1.5</version>
+ <version>1.5.1-SNAPSHOT</version>
<name>Apache Commons CSV</name>
<url>http://commons.apache.org/proper/commons-csv/</url>
<description>
[04/34] commons-csv git commit: Updated RELEASE-NOTES.txt in
preparation for 1.5 release
Posted by st...@apache.org.
Updated RELEASE-NOTES.txt in preparation for 1.5 release
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/3894acc5
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/3894acc5
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/3894acc5
Branch: refs/heads/CSV-216
Commit: 3894acc53e1e75d4fc0359f05060a0eeb4033b6a
Parents: 067b046
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sat Aug 26 20:36:45 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Aug 27 10:51:00 2017 +1200
----------------------------------------------------------------------
RELEASE-NOTES.txt | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/3894acc5/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index e44042b..cf7c853 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,4 +1,61 @@
Apache Commons CSV
+ Version 1.5
+ Release Notes
+
+
+INTRODUCTION:
+
+This document contains the release notes for the 1.5 version of Apache Commons CSV.
+Commons CSV reads and writes files in variations of the Comma Separated Value (CSV) format.
+
+CSV requires at least Java 7.
+
+The Apache Commons CSV library provides a simple interface for reading and writing
+CSV files of various types.
+
+Feature and bug fix release
+
+Changes in this version include:
+
+NEW FEATURES
+==============
+
+o CSV-189: CSVParser: Add factory method accepting InputStream. Thanks to Peter Holzwarth, Gary Gregory.
+o CSV-190: Add convenience API CSVFormat.print(File, Charset). Thanks to Gary Gregory.
+o CSV-191: Add convenience API CSVFormat.print(Path, Charset). Thanks to Gary Gregory.
+o CSV-192: Add convenience API CSVParser.parse(Path, Charset, CSVFormat). Thanks to Gary Gregory.
+o CSV-205: Add convenience API CSVFormat#printer() to print to System.out. Thanks to Gary Gregory.
+o CSV-207: Provide a CSV Format for printing PostgreSQL CSV and Text formats. Thanks to Gary Gregory.
+o CSV-214: Adding a placeholder in the Lexer and CSV parser to store the end-of-line string. Thanks to Nitin Mahendru, Gary Gregory.
+
+FIXED BUGS
+============
+
+o CSV-203: withNullString value is printed without quotes when QuoteMode.ALL is specified; add QuoteMode.ALL_NON_NULL. PR #17. Thanks to Richard Wheeldon, Kai Paroth.
+o CSV-194: Fix outdated comments about FileReader in CSVParser #13. Thanks to Marc Prud'hommeaux.
+o CSV-193: Fix incorrect method name 'withFirstRowAsHeader' in user guide. Thanks to Matthias Wiehl.
+o CSV-171: Negative numeric values in the first column are always quoted in minimal mode. Thanks to Gary Gregory, Michael Graessle, Adrian Bridgett.
+
+CHANGES
+=========
+
+o CSV-187: Update platform requirement from Java 6 to 7. Thanks to Gary Gregory.
+o CSV-201: Do not use RuntimeException in CSVParser.iterator().new Iterator() {...}.getNextRecord(). Thanks to Benedikt Ritter, Gary Gregory.
+
+
+Historical list of changes: http://commons.apache.org/proper/commons-csv/changes-report.html
+
+For complete information on Apache Commons CSV, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache Apache Commons CSV website:
+
+http://commons.apache.org/proper/commons-csv/
+
+Have fun!
+-Apache Commons CSV team
+
+------------------------------------------------------------------------------
+
+ Apache Commons CSV
Version 1.4
Release Notes
[21/34] commons-csv git commit: findbugs-maven-plugin 3.0.4 -> 3.0.5.
Posted by st...@apache.org.
findbugs-maven-plugin 3.0.4 -> 3.0.5.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/27cdc557
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/27cdc557
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/27cdc557
Branch: refs/heads/CSV-216
Commit: 27cdc557283ee23e32384fcafcd9f2dcab416378
Parents: 0c216e7
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Oct 9 13:56:34 2017 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Oct 9 13:56:34 2017 -0600
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/27cdc557/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 266b509..8011872 100644
--- a/pom.xml
+++ b/pom.xml
@@ -271,7 +271,7 @@ CSV files of various types.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
- <version>3.0.4</version>
+ <version>3.0.5</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
[30/34] commons-csv git commit: Sort methods.
Posted by st...@apache.org.
Sort methods.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/34262e8c
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/34262e8c
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/34262e8c
Branch: refs/heads/CSV-216
Commit: 34262e8c5e0d6746b914468d9e8f739b9f3cfa13
Parents: 4f58df6
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Dec 11 11:49:36 2017 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Dec 11 11:49:36 2017 -0700
----------------------------------------------------------------------
.../java/org/apache/commons/csv/CSVFormat.java | 122 +++++++++----------
1 file changed, 61 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/34262e8c/src/main/java/org/apache/commons/csv/CSVFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index dc7588b..9e6c807 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -749,6 +749,16 @@ public final class CSVFormat implements Serializable {
}
/**
+ * Returns whether to flush on close.
+ *
+ * @return whether to flush on close.
+ * @since 1.6
+ */
+ public boolean getAutoFlush() {
+ return autoFlush;
+ }
+
+ /**
* Returns the character marking the start of a line comment.
*
* @return the comment start marker, may be {@code null}
@@ -891,16 +901,6 @@ public final class CSVFormat implements Serializable {
return trim;
}
- /**
- * Returns whether to flush on close.
- *
- * @return whether to flush on close.
- * @since 1.6
- */
- public boolean getAutoFlush() {
- return autoFlush;
- }
-
@Override
public int hashCode() {
final int prime = 31;
@@ -994,22 +994,6 @@ public final class CSVFormat implements Serializable {
}
/**
- * Prints to the {@link System#out}.
- *
- * <p>
- * See also {@link CSVPrinter}.
- * </p>
- *
- * @return a printer to {@link System#out}.
- * @throws IOException
- * thrown if the optional header cannot be printed.
- * @since 1.5
- */
- public CSVPrinter printer() throws IOException {
- return new CSVPrinter(System.out, this);
- }
-
- /**
* Prints to the specified output.
*
* <p>
@@ -1032,26 +1016,6 @@ public final class CSVFormat implements Serializable {
}
/**
- * Prints to the specified output.
- *
- * <p>
- * See also {@link CSVPrinter}.
- * </p>
- *
- * @param out
- * the output.
- * @param charset
- * A charset.
- * @return a printer to an output.
- * @throws IOException
- * thrown if the optional header cannot be printed.
- * @since 1.5
- */
- public CSVPrinter print(final Path out, final Charset charset) throws IOException {
- return print(Files.newBufferedWriter(out, charset));
- }
-
- /**
* Prints the {@code value} as the next value on the line to {@code out}. The value will be escaped or encapsulated
* as needed. Useful when one wants to avoid creating CSVPrinters.
*
@@ -1104,6 +1068,26 @@ public final class CSVFormat implements Serializable {
}
}
+ /**
+ * Prints to the specified output.
+ *
+ * <p>
+ * See also {@link CSVPrinter}.
+ * </p>
+ *
+ * @param out
+ * the output.
+ * @param charset
+ * A charset.
+ * @return a printer to an output.
+ * @throws IOException
+ * thrown if the optional header cannot be printed.
+ * @since 1.5
+ */
+ public CSVPrinter print(final Path out, final Charset charset) throws IOException {
+ return print(Files.newBufferedWriter(out, charset));
+ }
+
/*
* Note: must only be called if escaping is enabled, otherwise will generate NPE
*/
@@ -1254,6 +1238,22 @@ public final class CSVFormat implements Serializable {
}
/**
+ * Prints to the {@link System#out}.
+ *
+ * <p>
+ * See also {@link CSVPrinter}.
+ * </p>
+ *
+ * @return a printer to {@link System#out}.
+ * @throws IOException
+ * thrown if the optional header cannot be printed.
+ * @since 1.5
+ */
+ public CSVPrinter printer() throws IOException {
+ return new CSVPrinter(System.out, this);
+ }
+
+ /**
* Outputs the trailing delimiter (if set) followed by the record separator (if set).
*
* @param out
@@ -1446,6 +1446,21 @@ public final class CSVFormat implements Serializable {
}
/**
+ * Returns a new {@code CSVFormat} with whether to flush on close.
+ *
+ * @param autoFlush
+ * whether to flush on close.
+ *
+ * @return A new CSVFormat that is equal to this but with the specified autoFlush setting.
+ * @since 1.6
+ */
+ public CSVFormat withAutoFlush(final boolean autoFlush) {
+ return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
+ ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
+ skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
+ }
+
+ /**
* Returns a new {@code CSVFormat} with the comment start marker of the format set to the specified character.
*
* Note that the comment start character is only recognized at the start of a line.
@@ -1959,19 +1974,4 @@ public final class CSVFormat implements Serializable {
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
}
-
- /**
- * Returns a new {@code CSVFormat} with whether to flush on close.
- *
- * @param autoFlush
- * whether to flush on close.
- *
- * @return A new CSVFormat that is equal to this but with the specified autoFlush setting.
- * @since 1.6
- */
- public CSVFormat withAutoFlush(final boolean autoFlush) {
- return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
- ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
- skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
- }
}
[09/34] commons-csv git commit: Update CONTRIBUTING.md for 1.5 release
Posted by st...@apache.org.
Update CONTRIBUTING.md for 1.5 release
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/067b0462
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/067b0462
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/067b0462
Branch: refs/heads/CSV-216
Commit: 067b046223a0ea85d5572a34056d0105c61c6bdf
Parents: 9479bfa
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sat Aug 26 20:24:06 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Aug 27 10:51:00 2017 +1200
----------------------------------------------------------------------
CONTRIBUTING.md | 40 +++++++++++++++++++++++++++++-----------
1 file changed, 29 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/067b0462/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 121e39f..a259af1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -51,47 +51,65 @@ Getting Started
+ Make sure you have a [JIRA account](https://issues.apache.org/jira/).
+ Make sure you have a [GitHub account](https://github.com/signup/free).
+ If you're planning to implement a new feature it makes sense to discuss you're changes on the [dev list](https://commons.apache.org/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Commons CSV's scope.
-+ Submit a ticket for your issue, assuming one does not already exist.
++ Submit a [Jira Ticket][jira] for your issue, assuming one does not already exist.
+ Clearly describe the issue including steps to reproduce when it is a bug.
+ Make sure you fill in the earliest version that you know has the issue.
-+ Fork the repository on GitHub.
++ Find the corresponding [repository on GitHub](https://github.com/apache/?query=commons-),
+[fork](https://help.github.com/articles/fork-a-repo/) and check out your forked repository.
Making Changes
--------------
-+ Create a topic branch from where you want to base your work (this is usually the master/trunk branch).
++ Create a _topic branch_ for your isolated work.
+ * Usually you should base your branch on the `master` or `trunk` branch.
+ * A good topic branch name can be the JIRA bug id plus a keyword, e.g. `CSV-123-InputStream`.
+ * If you have submitted multiple JIRA issues, try to maintain separate branches and pull requests.
+ Make commits of logical units.
+ * Make sure your commit messages are meaningful and in the proper format. Your commit message should contain the key of the JIRA issue.
+ * e.g. `CSV-123: Close input stream earlier`
+ Respect the original code style:
+ Only use spaces for indentation.
- + Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
- + Check for unnecessary whitespace with git diff --check before committing.
-+ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue.
-+ Make sure you have added the necessary tests for your changes.
+ + Create minimal diffs - disable _On Save_ actions like _Reformat Source Code_ or _Organize Imports_. If you feel the source code should be reformatted create a separate PR for this change first.
+ + Check for unnecessary whitespace with `git diff` -- check before committing.
++ Make sure you have added the necessary tests for your changes, typically in `src/test/java`.
+ Run all the tests with `mvn clean verify` to assure nothing else was accidentally broken.
Making Trivial Changes
----------------------
+The JIRA tickets are used to generate the changelog for the next release.
+
For changes of a trivial nature to comments and documentation, it is not always necessary to create a new ticket in JIRA.
In this case, it is appropriate to start the first line of a commit with '(doc)' instead of a ticket number.
+
Submitting Changes
------------------
-+ Sign the [Contributor License Agreement][cla] if you haven't already.
++ Sign and submit the Apache [Contributor License Agreement][cla] if you haven't already.
+ * Note that small patches & typical bug fixes do not require a CLA as
+ clause 5 of the [Apache License](https://www.apache.org/licenses/LICENSE-2.0.html#contributions)
+ covers them.
+ Push your changes to a topic branch in your fork of the repository.
-+ Submit a pull request to the repository in the apache organization.
++ Submit a _Pull Request_ to the corresponding repository in the `apache` organization.
+ * Verify _Files Changed_ shows only your intended changes and does not
+ include additional files like `target/*.class`
+ Update your JIRA ticket and include a link to the pull request in the ticket.
+If you prefer to not use GitHub, then you can instead use
+`git format-patch` (or `svn diff`) and attach the patch file to the JIRA issue.
+
+
Additional Resources
--------------------
+ [Contributing patches](https://commons.apache.org/patches.html)
-+ [Apache Commons CSV JIRA project page](https://issues.apache.org/jira/browse/CSV)
++ [Apache Commons CSV JIRA project page][jira]
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
+ [Apache Commons Twitter Account](https://twitter.com/ApacheCommons)
-+ #apachecommons IRC channel on freenode.org
++ `#apache-commons` IRC channel on `irc.freenode.net`
[cla]:https://www.apache.org/licenses/#clas
+[jira]:https://issues.apache.org/jira/browse/CSV
[17/34] commons-csv git commit: [CSV-217] Add autoFlush option for
CsvPrinter. Remove println() in test.
Posted by st...@apache.org.
[CSV-217] Add autoFlush option for CsvPrinter. Remove println() in test.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/3c0a73b3
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/3c0a73b3
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/3c0a73b3
Branch: refs/heads/CSV-216
Commit: 3c0a73b30f1969136987f25227383ae9d233e4c1
Parents: 9c20341
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Oct 9 13:24:47 2017 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Oct 9 13:24:47 2017 -0600
----------------------------------------------------------------------
src/test/java/org/apache/commons/csv/CSVPrinterTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/3c0a73b3/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
index 893675c..30eb652 100644
--- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
@@ -1347,7 +1347,7 @@ public class CSVPrinterTest {
@Test
public void testCloseWithCsvFormatAutoFlushOn() throws IOException {
- System.out.println("start method");
+ // System.out.println("start method");
Writer writer = mock(Writer.class);
CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(true);
try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
[10/34] commons-csv git commit: Updated README.md for release 1.5
Posted by st...@apache.org.
Updated README.md for release 1.5
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/9479bfaa
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/9479bfaa
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/9479bfaa
Branch: refs/heads/CSV-216
Commit: 9479bfaaa9948e93c68d15f9315afb6ef5c4c72c
Parents: d032c24
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sat Aug 26 20:21:48 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Aug 27 10:51:00 2017 +1200
----------------------------------------------------------------------
README.md | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/9479bfaa/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 2f6e6e7..87f1c60 100644
--- a/README.md
+++ b/README.md
@@ -43,18 +43,18 @@
Apache Commons CSV
===================
-The Apache Commons CSV library provides a simple interface for reading and writing
-CSV files of various types.
-
[![Build Status](https://travis-ci.org/apache/commons-csv.svg?branch=master)](https://travis-ci.org/apache/commons-csv)
-[![Coverage Status](https://coveralls.io/repos/github/apache/commons-csv/badge.svg?branch=master)](https://coveralls.io/github/apache/commons-csv?branch=master)
+[![Coverage Status](https://coveralls.io/repos/apache/commons-csv/badge.svg?branch=master)](https://coveralls.io/r/apache/commons-csv)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-csv/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-csv/)
[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
+The Apache Commons CSV library provides a simple interface for reading and writing
+CSV files of various types.
+
Documentation
-------------
-More information can be found on the [homepage](https://commons.apache.org/proper/commons-csv).
+More information can be found on the [Apache Commons CSV homepage](https://commons.apache.org/proper/commons-csv).
The [JavaDoc](https://commons.apache.org/proper/commons-csv/javadocs/api-release) can be browsed.
Questions related to the usage of Apache Commons CSV should be posted to the [user mailing list][ml].
@@ -68,14 +68,14 @@ Alternatively you can pull it from the central Maven repositories:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
- <version>1.4</version>
+ <version>1.5</version>
</dependency>
```
Contributing
------------
-We accept PRs via github. The [developer mailing list][ml] is the main channel of communication for contributors.
+We accept Pull Requests via GitHub. The [developer mailing list][ml] is the main channel of communication for contributors.
There are some guidelines which will make applying PRs easier for us:
+ No tabs! Please use spaces for indentation.
+ Respect the code style.
@@ -87,7 +87,9 @@ You can learn more about contributing via GitHub in our [contribution guidelines
License
-------
-Code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0.txt).
+This code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0).
+
+See the `NOTICE.txt` file for required notices and attributions.
Donations
---------
@@ -97,8 +99,8 @@ Additional Resources
--------------------
+ [Apache Commons Homepage](https://commons.apache.org/)
-+ [Apache Bugtracker (JIRA)](https://issues.apache.org/jira/)
++ [Apache Issue Tracker (JIRA)](https://issues.apache.org/jira/browse/CSV)
+ [Apache Commons Twitter Account](https://twitter.com/ApacheCommons)
-+ #apachecommons IRC channel on freenode.org
++ `#apache-commons` IRC channel on `irc.freenode.org`
[ml]:https://commons.apache.org/mail-lists.html
[19/34] commons-csv git commit: [CSV-217] Add autoFlush option for
CsvPrinter. Use current version of Mockito.
Posted by st...@apache.org.
[CSV-217] Add autoFlush option for CsvPrinter. Use current version of
Mockito.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/b4a084ed
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/b4a084ed
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/b4a084ed
Branch: refs/heads/CSV-216
Commit: b4a084ed4839f297ab3f88c48d48f5081f229c96
Parents: 5ca0f91
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Oct 9 13:26:57 2017 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Oct 9 13:26:57 2017 -0600
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/b4a084ed/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a9777da..266b509 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,7 @@ CSV files of various types.
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
- <version>1.9.5</version>
+ <version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
[28/34] commons-csv git commit: [CSV-219] The behavior of quote char
using is not similar as Excel does when the first string contains CJK
char(s). [CSV-172] Don't quote cells just because they have UTF-8 encoded
characters.
Posted by st...@apache.org.
[CSV-219] The behavior of quote char using is not similar as Excel does
when the first string contains CJK char(s).
[CSV-172] Don't quote cells just because they have UTF-8 encoded
characters.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/8b3de71f
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/8b3de71f
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/8b3de71f
Branch: refs/heads/CSV-216
Commit: 8b3de71fd99d0fa07cb6a3a35b583bbb170aab66
Parents: e76c4d8
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Dec 11 11:16:01 2017 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Dec 11 11:16:01 2017 -0700
----------------------------------------------------------------------
src/changes/changes.xml | 2 ++
src/main/java/org/apache/commons/csv/CSVFormat.java | 5 +----
.../java/org/apache/commons/csv/CSVPrinterTest.java | 13 +++++++++++--
3 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/8b3de71f/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b56b75f..302632e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -40,6 +40,8 @@
<body>
<release version="1.6" date="2017-MM-DD" description="Feature and bug fix release">
<action issue="CSV-217" type="add" dev="ggregory" due-to="Korolyov Alexei">Add autoFlush option for CsvPrinter. PR #24.</action>
+ <action issue="CSV-219" type="fix" dev="ggregory" due-to="Zhang Hongda">The behavior of quote char using is not similar as Excel does when the first string contains CJK char(s).</action>
+ <action issue="CSV-172" type="fix" dev="ggregory" due-to="Andrew Pennebaker">Don't quote cells just because they have UTF-8 encoded characters.</action>
</release>
<release version="1.5" date="2017-09-03" description="Feature and bug fix release">
<action issue="CSV-203" type="fix" dev="ggregory" due-to="Richard Wheeldon, Kai Paroth">withNullString value is printed without quotes when QuoteMode.ALL is specified; add QuoteMode.ALL_NON_NULL. PR #17.</action>
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/8b3de71f/src/main/java/org/apache/commons/csv/CSVFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index 58948fd..dc7588b 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -1186,10 +1186,7 @@ public final class CSVFormat implements Serializable {
} else {
char c = value.charAt(pos);
- // RFC4180 (https://tools.ietf.org/html/rfc4180) TEXTDATA = %x20-21 / %x23-2B / %x2D-7E
- if (newRecord && (c < 0x20 || c > 0x21 && c < 0x23 || c > 0x2B && c < 0x2D || c > 0x7E)) {
- quote = true;
- } else if (c <= COMMENT) {
+ if (c <= COMMENT) {
// Some other chars at the start of a value caused the parser to fail, so for now
// encapsulate if we start in anything less than '#'. We are being conservative
// by including the default comment char too.
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/8b3de71f/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
index ae7aae2..5a09627 100644
--- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
@@ -1033,11 +1033,20 @@ public class CSVPrinterTest {
}
@Test
- public void testRfc4180QuoteSingleChar() throws IOException {
+ public void testDontQuoteEuroFirstChar() throws IOException {
final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180)) {
printer.printRecord(EURO_CH, "Deux");
- assertEquals("\"" + EURO_CH + "\",Deux" + recordSeparator, sw.toString());
+ assertEquals(EURO_CH + ",Deux" + recordSeparator, sw.toString());
+ }
+ }
+
+ @Test
+ public void testQuoteCommaFirstChar() throws IOException {
+ final StringWriter sw = new StringWriter();
+ try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180)) {
+ printer.printRecord(",");
+ assertEquals("\",\"" + recordSeparator, sw.toString());
}
}
[06/34] commons-csv git commit: Update download page in preparation
for 1.5 release
Posted by st...@apache.org.
Update download page in preparation for 1.5 release
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/07101efb
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/07101efb
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/07101efb
Branch: refs/heads/CSV-216
Commit: 07101efb96ac924507e339cfbd04a7f154c01a80
Parents: dfcd079
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sat Aug 26 19:58:54 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Aug 27 10:51:00 2017 +1200
----------------------------------------------------------------------
src/site/xdoc/download_csv.xml | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/07101efb/src/site/xdoc/download_csv.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/download_csv.xml b/src/site/xdoc/download_csv.xml
index 9f6425c..ab02d63 100644
--- a/src/site/xdoc/download_csv.xml
+++ b/src/site/xdoc/download_csv.xml
@@ -111,32 +111,32 @@ limitations under the License.
</p>
</subsection>
</section>
- <section name="Apache Commons CSV 1.4 (Java 6.0+)">
+ <section name="Apache Commons CSV 1.5 (Java 7+)">
<subsection name="Binaries">
<table>
<tr>
- <td><a href="[preferred]/commons/csv/binaries/commons-csv-1.4-bin.tar.gz">commons-csv-1.4-bin.tar.gz</a></td>
- <td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.4-bin.tar.gz.md5">md5</a></td>
- <td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.4-bin.tar.gz.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/csv/binaries/commons-csv-1.5-bin.tar.gz">commons-csv-1.5-bin.tar.gz</a></td>
+ <td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.5-bin.tar.gz.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.5-bin.tar.gz.asc">pgp</a></td>
</tr>
<tr>
- <td><a href="[preferred]/commons/csv/binaries/commons-csv-1.4-bin.zip">commons-csv-1.4-bin.zip</a></td>
- <td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.4-bin.zip.md5">md5</a></td>
- <td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.4-bin.zip.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/csv/binaries/commons-csv-1.5-bin.zip">commons-csv-1.5-bin.zip</a></td>
+ <td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.5-bin.zip.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.5-bin.zip.asc">pgp</a></td>
</tr>
</table>
</subsection>
<subsection name="Source">
<table>
<tr>
- <td><a href="[preferred]/commons/csv/source/commons-csv-1.4-src.tar.gz">commons-csv-1.4-src.tar.gz</a></td>
- <td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.4-src.tar.gz.md5">md5</a></td>
- <td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.4-src.tar.gz.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/csv/source/commons-csv-1.5-src.tar.gz">commons-csv-1.5-src.tar.gz</a></td>
+ <td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.5-src.tar.gz.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.5-src.tar.gz.asc">pgp</a></td>
</tr>
<tr>
- <td><a href="[preferred]/commons/csv/source/commons-csv-1.4-src.zip">commons-csv-1.4-src.zip</a></td>
- <td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.4-src.zip.md5">md5</a></td>
- <td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.4-src.zip.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/csv/source/commons-csv-1.5-src.zip">commons-csv-1.5-src.zip</a></td>
+ <td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.5-src.zip.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.5-src.zip.asc">pgp</a></td>
</tr>
</table>
</subsection>
[33/34] commons-csv git commit: Slightly better Javadoc.
Posted by st...@apache.org.
Slightly better Javadoc.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/eede739d
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/eede739d
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/eede739d
Branch: refs/heads/CSV-216
Commit: eede739d18c69722ff39e8e42df6b68ae7627082
Parents: f3f48be
Author: Gary Gregory <gg...@apache.org>
Authored: Tue Jan 9 10:31:48 2018 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Tue Jan 9 10:31:48 2018 -0700
----------------------------------------------------------------------
src/main/java/org/apache/commons/csv/QuoteMode.java | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/eede739d/src/main/java/org/apache/commons/csv/QuoteMode.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/QuoteMode.java b/src/main/java/org/apache/commons/csv/QuoteMode.java
index 216f775..272deb7 100644
--- a/src/main/java/org/apache/commons/csv/QuoteMode.java
+++ b/src/main/java/org/apache/commons/csv/QuoteMode.java
@@ -17,8 +17,7 @@
package org.apache.commons.csv;
/**
- * Defines quote behavior when printing.
- *
+ * Defines quoting behavior when printing.
*/
public enum QuoteMode {
@@ -33,8 +32,8 @@ public enum QuoteMode {
ALL_NON_NULL,
/**
- * Quotes fields which contain special characters such as a delimiter, quotes character or any of the characters in
- * line separator.
+ * Quotes fields which contain special characters such as a the field delimiter, quote character or any of the
+ * characters in the line separator string.
*/
MINIMAL,
@@ -44,8 +43,8 @@ public enum QuoteMode {
NON_NUMERIC,
/**
- * Never quotes fields. When the delimiter occurs in data, the printer prefixes it with the current escape
- * character. If the escape character is not set, format validation throws an exception.
+ * Never quotes fields. When the delimiter occurs in data, the printer prefixes it with the escape character. If the
+ * escape character is not set, format validation throws an exception.
*/
NONE
}
[23/34] commons-csv git commit: Update tests from Apache Commons IO
2.5 to 2.6.
Posted by st...@apache.org.
Update tests from Apache Commons IO 2.5 to 2.6.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/0e39fe3b
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/0e39fe3b
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/0e39fe3b
Branch: refs/heads/CSV-216
Commit: 0e39fe3bed3444e1b989c2a0a90c1d8e6bb36ccc
Parents: 27cdc55
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Oct 20 10:04:51 2017 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Oct 20 10:04:51 2017 -0600
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0e39fe3b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8011872..526faa7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,7 +47,7 @@ CSV files of various types.
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.5</version>
+ <version>2.6</version>
<scope>test</scope>
</dependency>
<dependency>
[25/34] commons-csv git commit: Fix Javadocs typos
Posted by st...@apache.org.
Fix Javadocs typos
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/0051a83d
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/0051a83d
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/0051a83d
Branch: refs/heads/CSV-216
Commit: 0051a83dcdceb818562fd30d7f195b91a549985f
Parents: 1521cc2
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sun Oct 22 00:13:22 2017 +1300
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Oct 22 00:13:22 2017 +1300
----------------------------------------------------------------------
src/main/java/org/apache/commons/csv/CSVFormat.java | 4 ++--
src/main/java/org/apache/commons/csv/Lexer.java | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0051a83d/src/main/java/org/apache/commons/csv/CSVFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index 00f1064..58948fd 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -1859,7 +1859,7 @@ public final class CSVFormat implements Serializable {
* @param recordSeparator
* the record separator to use for output.
*
- * @return A new CSVFormat that is equal to this but with the the specified output record separator
+ * @return A new CSVFormat that is equal to this but with the specified output record separator
*/
public CSVFormat withRecordSeparator(final char recordSeparator) {
return withRecordSeparator(String.valueOf(recordSeparator));
@@ -1876,7 +1876,7 @@ public final class CSVFormat implements Serializable {
* @param recordSeparator
* the record separator to use for output.
*
- * @return A new CSVFormat that is equal to this but with the the specified output record separator
+ * @return A new CSVFormat that is equal to this but with the specified output record separator
* @throws IllegalArgumentException
* if recordSeparator is none of CR, LF or CRLF
*/
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0051a83d/src/main/java/org/apache/commons/csv/Lexer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/Lexer.java b/src/main/java/org/apache/commons/csv/Lexer.java
index 8106532..76fa81e 100644
--- a/src/main/java/org/apache/commons/csv/Lexer.java
+++ b/src/main/java/org/apache/commons/csv/Lexer.java
@@ -326,7 +326,7 @@ final class Lexer implements Closeable {
* @return the unescaped character (as an int) or {@link Constants#END_OF_STREAM} if char following the escape is
* invalid.
* @throws IOException if there is a problem reading the stream or the end of stream is detected:
- * the escape character is not allowed at end of strem
+ * the escape character is not allowed at end of stream
*/
int readEscape() throws IOException {
// the escape char has just been read (normally a backslash)
[24/34] commons-csv git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/commons-csv.git
Posted by st...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/commons-csv.git
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/1521cc28
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/1521cc28
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/1521cc28
Branch: refs/heads/CSV-216
Commit: 1521cc285daf9923d09bd112892647c60e59a750
Parents: 0e39fe3 d20e5ab
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Oct 20 17:27:45 2017 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Oct 20 17:27:45 2017 -0600
----------------------------------------------------------------------
.travis.yml | 1 +
pom.xml | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/1521cc28/pom.xml
----------------------------------------------------------------------
[20/34] commons-csv git commit: Use final.
Posted by st...@apache.org.
Use final.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/0c216e78
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/0c216e78
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/0c216e78
Branch: refs/heads/CSV-216
Commit: 0c216e783cbff346c820cabb83486e4401b2c0a2
Parents: b4a084e
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Oct 9 13:43:02 2017 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Oct 9 13:43:02 2017 -0600
----------------------------------------------------------------------
.../java/org/apache/commons/csv/CSVFormat.java | 6 +-
.../java/org/apache/commons/csv/CSVParser.java | 2 +-
.../java/org/apache/commons/csv/CSVPrinter.java | 2 +-
.../org/apache/commons/csv/CSVFormatTest.java | 36 +++++------
.../org/apache/commons/csv/CSVParserTest.java | 2 +-
.../org/apache/commons/csv/CSVPrinterTest.java | 64 ++++++++++----------
.../commons/csv/issues/JiraCsv198Test.java | 6 +-
.../commons/csv/issues/JiraCsv203Test.java | 42 ++++++-------
.../commons/csv/issues/JiraCsv213Test.java | 6 +-
9 files changed, 83 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0c216e78/src/main/java/org/apache/commons/csv/CSVFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index 29b7c36..00f1064 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -630,7 +630,7 @@ public final class CSVFormat implements Serializable {
final boolean ignoreEmptyLines, final String recordSeparator, final String nullString,
final Object[] headerComments, final String[] header, final boolean skipHeaderRecord,
final boolean allowMissingColumnNames, final boolean ignoreHeaderCase, final boolean trim,
- final boolean trailingDelimiter, boolean autoFlush) {
+ final boolean trailingDelimiter, final boolean autoFlush) {
this.delimiter = delimiter;
this.quoteCharacter = quoteChar;
this.quoteMode = quoteMode;
@@ -1026,7 +1026,7 @@ public final class CSVFormat implements Serializable {
* @since 1.5
*/
@SuppressWarnings("resource")
- public CSVPrinter print(final File out, Charset charset) throws IOException {
+ public CSVPrinter print(final File out, final Charset charset) throws IOException {
// The writer will be closed when close() is called.
return new CSVPrinter(new OutputStreamWriter(new FileOutputStream(out), charset), this);
}
@@ -1047,7 +1047,7 @@ public final class CSVFormat implements Serializable {
* thrown if the optional header cannot be printed.
* @since 1.5
*/
- public CSVPrinter print(final Path out, Charset charset) throws IOException {
+ public CSVPrinter print(final Path out, final Charset charset) throws IOException {
return print(Files.newBufferedWriter(out, charset));
}
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0c216e78/src/main/java/org/apache/commons/csv/CSVParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java b/src/main/java/org/apache/commons/csv/CSVParser.java
index 09251a3..06108f6 100644
--- a/src/main/java/org/apache/commons/csv/CSVParser.java
+++ b/src/main/java/org/apache/commons/csv/CSVParser.java
@@ -225,7 +225,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
* If there is a problem reading the header or skipping the first record
* @since 1.5
*/
- public static CSVParser parse(Reader reader, final CSVFormat format) throws IOException {
+ public static CSVParser parse(final Reader reader, final CSVFormat format) throws IOException {
return new CSVParser(reader, format);
}
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0c216e78/src/main/java/org/apache/commons/csv/CSVPrinter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVPrinter.java b/src/main/java/org/apache/commons/csv/CSVPrinter.java
index 49d9022..c8ce042 100644
--- a/src/main/java/org/apache/commons/csv/CSVPrinter.java
+++ b/src/main/java/org/apache/commons/csv/CSVPrinter.java
@@ -92,7 +92,7 @@ public final class CSVPrinter implements Flushable, Closeable {
* If an I/O error occurs
* @since 1.6
*/
- public void close(boolean flush) throws IOException {
+ public void close(final boolean flush) throws IOException {
if (flush || format.getAutoFlush()) {
if (out instanceof Flushable) {
((Flushable) out).flush();
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0c216e78/src/test/java/org/apache/commons/csv/CSVFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/csv/CSVFormatTest.java b/src/test/java/org/apache/commons/csv/CSVFormatTest.java
index d458555..7eb0ce5 100644
--- a/src/test/java/org/apache/commons/csv/CSVFormatTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVFormatTest.java
@@ -462,8 +462,8 @@ public class CSVFormatTest {
@Test
public void testToStringAndWithCommentMarkerTakingCharacter() {
- CSVFormat.Predefined cSVFormat_Predefined = CSVFormat.Predefined.Default;
- CSVFormat cSVFormat = cSVFormat_Predefined.getFormat();
+ final CSVFormat.Predefined cSVFormat_Predefined = CSVFormat.Predefined.Default;
+ final CSVFormat cSVFormat = cSVFormat_Predefined.getFormat();
assertNull(cSVFormat.getEscapeCharacter());
assertTrue(cSVFormat.isQuoteCharacterSet());
@@ -492,9 +492,9 @@ public class CSVFormatTest {
assertTrue(cSVFormat.getIgnoreEmptyLines());
assertEquals('\"', (char)cSVFormat.getQuoteCharacter());
- Character character = Character.valueOf('n');
+ final Character character = Character.valueOf('n');
- CSVFormat cSVFormatTwo = cSVFormat.withCommentMarker(character);
+ final CSVFormat cSVFormatTwo = cSVFormat.withCommentMarker(character);
assertNull(cSVFormat.getEscapeCharacter());
assertTrue(cSVFormat.isQuoteCharacterSet());
@@ -625,7 +625,7 @@ public class CSVFormatTest {
@Test
public void testNewFormat() {
- CSVFormat cSVFormat = CSVFormat.newFormat('X');
+ final CSVFormat cSVFormat = CSVFormat.newFormat('X');
assertFalse(cSVFormat.getSkipHeaderRecord());
assertFalse(cSVFormat.isEscapeCharacterSet());
@@ -687,7 +687,7 @@ public class CSVFormatTest {
@Test
public void testWithHeaderComments() {
- CSVFormat cSVFormat = CSVFormat.DEFAULT;
+ final CSVFormat cSVFormat = CSVFormat.DEFAULT;
assertEquals('\"', (char)cSVFormat.getQuoteCharacter());
assertFalse(cSVFormat.isCommentMarkerSet());
@@ -716,8 +716,8 @@ public class CSVFormatTest {
assertFalse(cSVFormat.getIgnoreSurroundingSpaces());
assertNull(cSVFormat.getEscapeCharacter());
- Object[] objectArray = new Object[8];
- CSVFormat cSVFormatTwo = cSVFormat.withHeaderComments(objectArray);
+ final Object[] objectArray = new Object[8];
+ final CSVFormat cSVFormatTwo = cSVFormat.withHeaderComments(objectArray);
assertEquals('\"', (char)cSVFormat.getQuoteCharacter());
assertFalse(cSVFormat.isCommentMarkerSet());
@@ -778,7 +778,7 @@ public class CSVFormatTest {
assertTrue(cSVFormatTwo.equals(cSVFormat));
- String string = cSVFormatTwo.format(objectArray);
+ final String string = cSVFormatTwo.format(objectArray);
assertEquals('\"', (char)cSVFormat.getQuoteCharacter());
assertFalse(cSVFormat.isCommentMarkerSet());
@@ -849,12 +849,12 @@ public class CSVFormatTest {
@Test //I assume this to be a defect.
public void testFormatThrowsNullPointerException() {
- CSVFormat cSVFormat = CSVFormat.MYSQL;
+ final CSVFormat cSVFormat = CSVFormat.MYSQL;
try {
cSVFormat.format(null);
fail("Expecting exception: NullPointerException");
- } catch(NullPointerException e) {
+ } catch(final NullPointerException e) {
assertEquals(CSVFormat.class.getName(), e.getStackTrace()[0].getClassName());
}
@@ -864,8 +864,8 @@ public class CSVFormatTest {
@Test
public void testEqualsOne() {
- CSVFormat cSVFormatOne = CSVFormat.INFORMIX_UNLOAD;
- CSVFormat cSVFormatTwo = CSVFormat.MYSQL;
+ final CSVFormat cSVFormatOne = CSVFormat.INFORMIX_UNLOAD;
+ final CSVFormat cSVFormatTwo = CSVFormat.MYSQL;
assertEquals('\\', (char)cSVFormatOne.getEscapeCharacter());
@@ -994,7 +994,7 @@ public class CSVFormatTest {
@Test
public void testEqualsWithNull() {
- CSVFormat cSVFormat = CSVFormat.POSTGRESQL_TEXT;
+ final CSVFormat cSVFormat = CSVFormat.POSTGRESQL_TEXT;
assertEquals('\"', (char)cSVFormat.getEscapeCharacter());
assertFalse(cSVFormat.getIgnoreSurroundingSpaces());
@@ -1058,8 +1058,8 @@ public class CSVFormatTest {
@Test
public void testToString() {
- CSVFormat cSVFormat = CSVFormat.POSTGRESQL_TEXT;
- String string = cSVFormat.INFORMIX_UNLOAD.toString();
+ final CSVFormat cSVFormat = CSVFormat.POSTGRESQL_TEXT;
+ final String string = cSVFormat.INFORMIX_UNLOAD.toString();
assertEquals("Delimiter=<|> Escape=<\\> QuoteChar=<\"> RecordSeparator=<\n> EmptyLines:ignored SkipHeaderRecord:false", string);
@@ -1069,8 +1069,8 @@ public class CSVFormatTest {
@Test
public void testHashCodeAndWithIgnoreHeaderCase() {
- CSVFormat cSVFormat = CSVFormat.INFORMIX_UNLOAD_CSV;
- CSVFormat cSVFormatTwo = cSVFormat.withIgnoreHeaderCase();
+ final CSVFormat cSVFormat = CSVFormat.INFORMIX_UNLOAD_CSV;
+ final CSVFormat cSVFormatTwo = cSVFormat.withIgnoreHeaderCase();
cSVFormatTwo.hashCode();
assertTrue(cSVFormatTwo.getIgnoreHeaderCase());
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0c216e78/src/test/java/org/apache/commons/csv/CSVParserTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/csv/CSVParserTest.java b/src/test/java/org/apache/commons/csv/CSVParserTest.java
index 462e32c..07e06bc 100644
--- a/src/test/java/org/apache/commons/csv/CSVParserTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVParserTest.java
@@ -74,7 +74,7 @@ public class CSVParserTest {
private static final String[][] RESULT = { { "a", "b", "c", "d" }, { "a", "b", "1 2" }, { "foo baar", "b", "" },
{ "foo\n,,\n\",,\n\"", "d", "e" } };
- private BOMInputStream createBOMInputStream(String resource) throws IOException {
+ private BOMInputStream createBOMInputStream(final String resource) throws IOException {
final URL url = ClassLoader.getSystemClassLoader().getResource(resource);
return new BOMInputStream(url.openStream());
}
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0c216e78/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
index 30eb652..ae7aae2 100644
--- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
@@ -304,7 +304,7 @@ public class CSVPrinterTest {
@Test
public void testEscapeBackslash1() throws IOException {
- StringWriter sw = new StringWriter();
+ final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withQuote(QUOTE_CH))) {
printer.print("\\");
}
@@ -313,7 +313,7 @@ public class CSVPrinterTest {
@Test
public void testEscapeBackslash2() throws IOException {
- StringWriter sw = new StringWriter();
+ final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withQuote(QUOTE_CH))) {
printer.print("\\\r");
}
@@ -322,7 +322,7 @@ public class CSVPrinterTest {
@Test
public void testEscapeBackslash3() throws IOException {
- StringWriter sw = new StringWriter();
+ final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withQuote(QUOTE_CH))) {
printer.print("X\\\r");
}
@@ -331,7 +331,7 @@ public class CSVPrinterTest {
@Test
public void testEscapeBackslash4() throws IOException {
- StringWriter sw = new StringWriter();
+ final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withQuote(QUOTE_CH))) {
printer.print("\\\\");
}
@@ -340,7 +340,7 @@ public class CSVPrinterTest {
@Test
public void testEscapeBackslash5() throws IOException {
- StringWriter sw = new StringWriter();
+ final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withQuote(QUOTE_CH))) {
printer.print("\\\\");
}
@@ -349,7 +349,7 @@ public class CSVPrinterTest {
@Test
public void testEscapeNull1() throws IOException {
- StringWriter sw = new StringWriter();
+ final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withEscape(null))) {
printer.print("\\");
}
@@ -358,7 +358,7 @@ public class CSVPrinterTest {
@Test
public void testEscapeNull2() throws IOException {
- StringWriter sw = new StringWriter();
+ final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withEscape(null))) {
printer.print("\\\r");
}
@@ -367,7 +367,7 @@ public class CSVPrinterTest {
@Test
public void testEscapeNull3() throws IOException {
- StringWriter sw = new StringWriter();
+ final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withEscape(null))) {
printer.print("X\\\r");
}
@@ -376,7 +376,7 @@ public class CSVPrinterTest {
@Test
public void testEscapeNull4() throws IOException {
- StringWriter sw = new StringWriter();
+ final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withEscape(null))) {
printer.print("\\\\");
}
@@ -385,7 +385,7 @@ public class CSVPrinterTest {
@Test
public void testEscapeNull5() throws IOException {
- StringWriter sw = new StringWriter();
+ final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withEscape(null))) {
printer.print("\\\\");
}
@@ -1115,7 +1115,7 @@ public class CSVPrinterTest {
@Test
public void testPrintToFileWithCharsetUtf16Be() throws IOException {
- File file = File.createTempFile(getClass().getName(), ".csv");
+ final File file = File.createTempFile(getClass().getName(), ".csv");
try (final CSVPrinter printer = CSVFormat.DEFAULT.print(file, StandardCharsets.UTF_16BE)) {
printer.printRecord("a", "b\\c");
}
@@ -1124,7 +1124,7 @@ public class CSVPrinterTest {
@Test
public void testPrintToFileWithDefaultCharset() throws IOException {
- File file = File.createTempFile(getClass().getName(), ".csv");
+ final File file = File.createTempFile(getClass().getName(), ".csv");
try (final CSVPrinter printer = CSVFormat.DEFAULT.print(file, Charset.defaultCharset())) {
printer.printRecord("a", "b\\c");
}
@@ -1133,7 +1133,7 @@ public class CSVPrinterTest {
@Test
public void testPrintToPathWithDefaultCharset() throws IOException {
- File file = File.createTempFile(getClass().getName(), ".csv");
+ final File file = File.createTempFile(getClass().getName(), ".csv");
try (final CSVPrinter printer = CSVFormat.DEFAULT.print(file.toPath(), Charset.defaultCharset())) {
printer.printRecord("a", "b\\c");
}
@@ -1282,8 +1282,8 @@ public class CSVPrinterTest {
@Test
public void testPrintRecordsWithResultSetOneRow() throws IOException, SQLException {
try (CSVPrinter csvPrinter = CSVFormat.MYSQL.printer()) {
- Value[] valueArray = new Value[0];
- ValueArray valueArrayTwo = ValueArray.get(valueArray);
+ final Value[] valueArray = new Value[0];
+ final ValueArray valueArrayTwo = ValueArray.get(valueArray);
try (ResultSet resultSet = valueArrayTwo.getResultSet()) {
csvPrinter.printRecords(resultSet);
assertEquals(0, resultSet.getRow());
@@ -1293,10 +1293,10 @@ public class CSVPrinterTest {
@Test
public void testPrintRecordsWithObjectArray() throws IOException {
- CharArrayWriter charArrayWriter = new CharArrayWriter(0);
+ final CharArrayWriter charArrayWriter = new CharArrayWriter(0);
try (CSVPrinter csvPrinter = CSVFormat.INFORMIX_UNLOAD.print(charArrayWriter)) {
- HashSet<BatchUpdateException> hashSet = new HashSet<>();
- Object[] objectArray = new Object[6];
+ final HashSet<BatchUpdateException> hashSet = new HashSet<>();
+ final Object[] objectArray = new Object[6];
objectArray[3] = hashSet;
csvPrinter.printRecords(objectArray);
}
@@ -1308,8 +1308,8 @@ public class CSVPrinterTest {
@Test
public void testPrintRecordsWithEmptyVector() throws IOException {
try (CSVPrinter csvPrinter = CSVFormat.POSTGRESQL_TEXT.printer()) {
- Vector<CSVFormatTest.EmptyEnum> vector = new Vector<>();
- int expectedCapacity = 23;
+ final Vector<CSVFormatTest.EmptyEnum> vector = new Vector<>();
+ final int expectedCapacity = 23;
vector.setSize(expectedCapacity);
csvPrinter.printRecords(vector);
assertEquals(expectedCapacity, vector.capacity());
@@ -1318,18 +1318,18 @@ public class CSVPrinterTest {
@Test
public void testCloseWithFlushOn() throws IOException {
- Writer writer = mock(Writer.class);
- CSVFormat csvFormat = CSVFormat.DEFAULT;
- CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat);
+ final Writer writer = mock(Writer.class);
+ final CSVFormat csvFormat = CSVFormat.DEFAULT;
+ final CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat);
csvPrinter.close(true);
verify(writer, times(1)).flush();
}
@Test
public void testCloseWithFlushOff() throws IOException {
- Writer writer = mock(Writer.class);
- CSVFormat csvFormat = CSVFormat.DEFAULT;
- CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat);
+ final Writer writer = mock(Writer.class);
+ final CSVFormat csvFormat = CSVFormat.DEFAULT;
+ final CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat);
csvPrinter.close(false);
verify(writer, never()).flush();
verify(writer, times(1)).close();
@@ -1337,8 +1337,8 @@ public class CSVPrinterTest {
@Test
public void testCloseBackwardCompatibility() throws IOException {
- Writer writer = mock(Writer.class);
- CSVFormat csvFormat = CSVFormat.DEFAULT;
+ final Writer writer = mock(Writer.class);
+ final CSVFormat csvFormat = CSVFormat.DEFAULT;
try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
}
verify(writer, never()).flush();
@@ -1348,8 +1348,8 @@ public class CSVPrinterTest {
@Test
public void testCloseWithCsvFormatAutoFlushOn() throws IOException {
// System.out.println("start method");
- Writer writer = mock(Writer.class);
- CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(true);
+ final Writer writer = mock(Writer.class);
+ final CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(true);
try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
}
verify(writer, times(1)).flush();
@@ -1358,8 +1358,8 @@ public class CSVPrinterTest {
@Test
public void testCloseWithCsvFormatAutoFlushOff() throws IOException {
- Writer writer = mock(Writer.class);
- CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(false);
+ final Writer writer = mock(Writer.class);
+ final CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(false);
try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
}
verify(writer, never()).flush();
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0c216e78/src/test/java/org/apache/commons/csv/issues/JiraCsv198Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/csv/issues/JiraCsv198Test.java b/src/test/java/org/apache/commons/csv/issues/JiraCsv198Test.java
index c0c38b7..a5722f9 100644
--- a/src/test/java/org/apache/commons/csv/issues/JiraCsv198Test.java
+++ b/src/test/java/org/apache/commons/csv/issues/JiraCsv198Test.java
@@ -33,12 +33,12 @@ public class JiraCsv198Test {
@Test
public void test() throws UnsupportedEncodingException, IOException {
- InputStream pointsOfReference = getClass().getResourceAsStream("/CSV-198/optd_por_public.csv");
+ final InputStream pointsOfReference = getClass().getResourceAsStream("/CSV-198/optd_por_public.csv");
Assert.assertNotNull(pointsOfReference);
try (@SuppressWarnings("resource")
CSVParser parser = CSV_FORMAT.parse(new InputStreamReader(pointsOfReference, "UTF-8"))) {
- for (CSVRecord record : parser) {
- String locationType = record.get("location_type");
+ for (final CSVRecord record : parser) {
+ final String locationType = record.get("location_type");
Assert.assertNotNull(locationType);
}
}
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0c216e78/src/test/java/org/apache/commons/csv/issues/JiraCsv203Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/csv/issues/JiraCsv203Test.java b/src/test/java/org/apache/commons/csv/issues/JiraCsv203Test.java
index 5e11570..bff193b 100644
--- a/src/test/java/org/apache/commons/csv/issues/JiraCsv203Test.java
+++ b/src/test/java/org/apache/commons/csv/issues/JiraCsv203Test.java
@@ -29,13 +29,13 @@ public class JiraCsv203Test {
@Test
public void testQuoteModeAll() throws Exception {
- CSVFormat format = CSVFormat.EXCEL
+ final CSVFormat format = CSVFormat.EXCEL
.withNullString("N/A")
.withIgnoreSurroundingSpaces(true)
.withQuoteMode(QuoteMode.ALL);
- StringBuffer buffer = new StringBuffer();
- CSVPrinter printer = new CSVPrinter(buffer, format);
+ final StringBuffer buffer = new StringBuffer();
+ final CSVPrinter printer = new CSVPrinter(buffer, format);
printer.printRecord(new Object[] { null, "Hello", null, "World" });
Assert.assertEquals("\"N/A\",\"Hello\",\"N/A\",\"World\"\r\n", buffer.toString());
@@ -43,13 +43,13 @@ public class JiraCsv203Test {
@Test
public void testQuoteModeAllNonNull() throws Exception {
- CSVFormat format = CSVFormat.EXCEL
+ final CSVFormat format = CSVFormat.EXCEL
.withNullString("N/A")
.withIgnoreSurroundingSpaces(true)
.withQuoteMode(QuoteMode.ALL_NON_NULL);
- StringBuffer buffer = new StringBuffer();
- CSVPrinter printer = new CSVPrinter(buffer, format);
+ final StringBuffer buffer = new StringBuffer();
+ final CSVPrinter printer = new CSVPrinter(buffer, format);
printer.printRecord(new Object[] { null, "Hello", null, "World" });
Assert.assertEquals("N/A,\"Hello\",N/A,\"World\"\r\n", buffer.toString());
@@ -57,12 +57,12 @@ public class JiraCsv203Test {
@Test
public void testWithoutQuoteMode() throws Exception {
- CSVFormat format = CSVFormat.EXCEL
+ final CSVFormat format = CSVFormat.EXCEL
.withNullString("N/A")
.withIgnoreSurroundingSpaces(true);
- StringBuffer buffer = new StringBuffer();
- CSVPrinter printer = new CSVPrinter(buffer, format);
+ final StringBuffer buffer = new StringBuffer();
+ final CSVPrinter printer = new CSVPrinter(buffer, format);
printer.printRecord(new Object[] { null, "Hello", null, "World" });
Assert.assertEquals("N/A,Hello,N/A,World\r\n", buffer.toString());
@@ -70,13 +70,13 @@ public class JiraCsv203Test {
@Test
public void testQuoteModeMinimal() throws Exception {
- CSVFormat format = CSVFormat.EXCEL
+ final CSVFormat format = CSVFormat.EXCEL
.withNullString("N/A")
.withIgnoreSurroundingSpaces(true)
.withQuoteMode(QuoteMode.MINIMAL);
- StringBuffer buffer = new StringBuffer();
- CSVPrinter printer = new CSVPrinter(buffer, format);
+ final StringBuffer buffer = new StringBuffer();
+ final CSVPrinter printer = new CSVPrinter(buffer, format);
printer.printRecord(new Object[] { null, "Hello", null, "World" });
Assert.assertEquals("N/A,Hello,N/A,World\r\n", buffer.toString());
@@ -84,13 +84,13 @@ public class JiraCsv203Test {
@Test
public void testQuoteModeNonNumeric() throws Exception {
- CSVFormat format = CSVFormat.EXCEL
+ final CSVFormat format = CSVFormat.EXCEL
.withNullString("N/A")
.withIgnoreSurroundingSpaces(true)
.withQuoteMode(QuoteMode.NON_NUMERIC);
- StringBuffer buffer = new StringBuffer();
- CSVPrinter printer = new CSVPrinter(buffer, format);
+ final StringBuffer buffer = new StringBuffer();
+ final CSVPrinter printer = new CSVPrinter(buffer, format);
printer.printRecord(new Object[] { null, "Hello", null, "World" });
Assert.assertEquals("N/A,\"Hello\",N/A,\"World\"\r\n", buffer.toString());
@@ -98,13 +98,13 @@ public class JiraCsv203Test {
@Test
public void testWithoutNullString() throws Exception {
- CSVFormat format = CSVFormat.EXCEL
+ final CSVFormat format = CSVFormat.EXCEL
//.withNullString("N/A")
.withIgnoreSurroundingSpaces(true)
.withQuoteMode(QuoteMode.ALL);
- StringBuffer buffer = new StringBuffer();
- CSVPrinter printer = new CSVPrinter(buffer, format);
+ final StringBuffer buffer = new StringBuffer();
+ final CSVPrinter printer = new CSVPrinter(buffer, format);
printer.printRecord(new Object[] { null, "Hello", null, "World" });
Assert.assertEquals(",\"Hello\",,\"World\"\r\n", buffer.toString());
@@ -112,13 +112,13 @@ public class JiraCsv203Test {
@Test
public void testWithEmptyValues() throws Exception {
- CSVFormat format = CSVFormat.EXCEL
+ final CSVFormat format = CSVFormat.EXCEL
.withNullString("N/A")
.withIgnoreSurroundingSpaces(true)
.withQuoteMode(QuoteMode.ALL);
- StringBuffer buffer = new StringBuffer();
- CSVPrinter printer = new CSVPrinter(buffer, format);
+ final StringBuffer buffer = new StringBuffer();
+ final CSVPrinter printer = new CSVPrinter(buffer, format);
printer.printRecord(new Object[] { "", "Hello", "", "World" });
//printer.printRecord(new Object[] { null, "Hello", null, "World" });
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/0c216e78/src/test/java/org/apache/commons/csv/issues/JiraCsv213Test.java
----------------------------------------------------------------------
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 fca82b8..18627a7 100644
--- a/src/test/java/org/apache/commons/csv/issues/JiraCsv213Test.java
+++ b/src/test/java/org/apache/commons/csv/issues/JiraCsv213Test.java
@@ -41,7 +41,7 @@ import org.junit.Test;
@Ignore
public class JiraCsv213Test {
- private void createEndChannel(File csvFile) {
+ private void createEndChannel(final File csvFile) {
// @formatter:off
final CSVFormat csvFormat =
CSVFormat.DEFAULT
@@ -56,11 +56,11 @@ public class JiraCsv213Test {
System.out.println(parser.getCurrentLineNumber());
System.out.println(parser.getRecordNumber());
// get only first record we don't need other's
- CSVRecord firstRecord = parser.iterator().next(); // this fails
+ final CSVRecord firstRecord = parser.iterator().next(); // this fails
return;
}
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new RuntimeException("Error while adding end channel to csv", e);
}
[26/34] commons-csv git commit: Remove trailing white spaces on all
lines.
Posted by st...@apache.org.
Remove trailing white spaces on all lines.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/c6cd6ce8
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/c6cd6ce8
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/c6cd6ce8
Branch: refs/heads/CSV-216
Commit: c6cd6ce8ee461328d3331fd96e82c8f8651b4ee4
Parents: 0051a83
Author: Gary Gregory <gg...@apache.org>
Authored: Wed Nov 1 16:05:40 2017 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Wed Nov 1 16:05:40 2017 -0600
----------------------------------------------------------------------
src/main/java/org/apache/commons/csv/CSVPrinter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/c6cd6ce8/src/main/java/org/apache/commons/csv/CSVPrinter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVPrinter.java b/src/main/java/org/apache/commons/csv/CSVPrinter.java
index c8ce042..6049173 100644
--- a/src/main/java/org/apache/commons/csv/CSVPrinter.java
+++ b/src/main/java/org/apache/commons/csv/CSVPrinter.java
@@ -87,7 +87,7 @@ public final class CSVPrinter implements Flushable, Closeable {
/**
* Closes the underlying stream with an optional flush first.
* @param flush whether to flush before the actual close.
- *
+ *
* @throws IOException
* If an I/O error occurs
* @since 1.6
[08/34] commons-csv git commit: Update change log for release 1.5
Posted by st...@apache.org.
Update change log for release 1.5
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/10671384
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/10671384
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/10671384
Branch: refs/heads/CSV-216
Commit: 10671384f5aae980bf84374d1ee3fb1a9e7d2a19
Parents: 07101ef
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Authored: Sat Aug 26 20:02:13 2017 +1200
Committer: Bruno P. Kinoshita <br...@yahoo.com.br>
Committed: Sun Aug 27 10:51:00 2017 +1200
----------------------------------------------------------------------
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/10671384/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 744ffc8..62fe6c2 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -38,7 +38,7 @@
<title>Release Notes</title>
</properties>
<body>
- <release version="1.5" date="2017-MM-DD" description="Bug fix release">
+ <release version="1.5" date="2017-08-26" description="Feature and bug fix release">
<action issue="CSV-203" type="fix" dev="ggregory" due-to="Richard Wheeldon, Kai Paroth">withNullString value is printed without quotes when QuoteMode.ALL is specified; add QuoteMode.ALL_NON_NULL. PR #17.</action>
<action issue="CSV-194" type="fix" dev="ggregory" due-to="Marc Prud'hommeaux">Fix outdated comments about FileReader in CSVParser #13</action>
<action issue="CSV-193" type="fix" dev="ggregory" due-to="Matthias Wiehl">Fix incorrect method name 'withFirstRowAsHeader' in user guide.</action>