commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject commons-csv git commit: Use final.
Date Mon, 09 Oct 2017 19:43:05 GMT
Repository: commons-csv
Updated Branches:
  refs/heads/master b4a084ed4 -> 0c216e783


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/master
Commit: 0c216e783cbff346c820cabb83486e4401b2c0a2
Parents: b4a084e
Author: Gary Gregory <ggregory@apache.org>
Authored: Mon Oct 9 13:43:02 2017 -0600
Committer: Gary Gregory <ggregory@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);
         }
 


Mime
View raw message