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