commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1397122 [1/2] - in /commons/proper/csv/trunk/src: main/java/org/apache/commons/csv/ test/java/org/apache/commons/csv/
Date Thu, 11 Oct 2012 15:47:45 GMT
Author: ggregory
Date: Thu Oct 11 15:47:44 2012
New Revision: 1397122

URL: http://svn.apache.org/viewvc?rev=1397122&view=rev
Log:
Use final keyword where possible.

Modified:
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer3.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/PerformanceTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Thu Oct 11 15:47:44 2012
@@ -155,8 +155,8 @@ public class CSVFormat implements Serial
      * @param header
      *            the header
      */
-    CSVFormat(char delimiter, char encapsulator, char commentStart, char escape, boolean surroundingSpacesIgnored,
-            boolean emptyLinesIgnored, String lineSeparator, String[] header) {
+    CSVFormat(final char delimiter, final char encapsulator, final char commentStart, final char escape, final boolean surroundingSpacesIgnored,
+            final boolean emptyLinesIgnored, final String lineSeparator, final String[] header) {
         this.delimiter = delimiter;
         this.encapsulator = encapsulator;
         this.commentStart = commentStart;
@@ -178,7 +178,7 @@ public class CSVFormat implements Serial
      *
      * @return true if <code>c</code> is a line break character
      */
-    private static boolean isLineBreak(char c) {
+    private static boolean isLineBreak(final char c) {
         return c == '\n' || c == '\r';
     }
 
@@ -230,7 +230,7 @@ public class CSVFormat implements Serial
      * @throws IllegalArgumentException
      *             thrown if the specified character is a line break
      */
-    public CSVFormat withDelimiter(char delimiter) {
+    public CSVFormat withDelimiter(final char delimiter) {
         if (isLineBreak(delimiter)) {
             throw new IllegalArgumentException("The delimiter cannot be a line break");
         }
@@ -256,7 +256,7 @@ public class CSVFormat implements Serial
      * @throws IllegalArgumentException
      *             thrown if the specified character is a line break
      */
-    public CSVFormat withEncapsulator(char encapsulator) {
+    public CSVFormat withEncapsulator(final char encapsulator) {
         if (isLineBreak(encapsulator)) {
             throw new IllegalArgumentException("The encapsulator cannot be a line break");
         }
@@ -293,7 +293,7 @@ public class CSVFormat implements Serial
      * @throws IllegalArgumentException
      *             thrown if the specified character is a line break
      */
-    public CSVFormat withCommentStart(char commentStart) {
+    public CSVFormat withCommentStart(final char commentStart) {
         if (isLineBreak(commentStart)) {
             throw new IllegalArgumentException("The comment start character cannot be a line break");
         }
@@ -330,7 +330,7 @@ public class CSVFormat implements Serial
      * @throws IllegalArgumentException
      *             thrown if the specified character is a line break
      */
-    public CSVFormat withEscape(char escape) {
+    public CSVFormat withEscape(final char escape) {
         if (isLineBreak(escape)) {
             throw new IllegalArgumentException("The escape character cannot be a line break");
         }
@@ -365,7 +365,7 @@ public class CSVFormat implements Serial
      *            spaces as is.
      * @return A copy of this format with the specified trimming behavior.
      */
-    public CSVFormat withIgnoreSurroundingSpaces(boolean ignoreSurroundingSpaces) {
+    public CSVFormat withIgnoreSurroundingSpaces(final boolean ignoreSurroundingSpaces) {
         return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces,
                 ignoreEmptyLines, lineSeparator, header);
     }
@@ -388,7 +388,7 @@ public class CSVFormat implements Serial
      *            <tt>false</tt> to translate empty lines to empty records.
      * @return A copy of this format with the specified empty line skipping behavior.
      */
-    public CSVFormat withIgnoreEmptyLines(boolean ignoreEmptyLines) {
+    public CSVFormat withIgnoreEmptyLines(final boolean ignoreEmptyLines) {
         return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces,
                 ignoreEmptyLines, lineSeparator, header);
     }
@@ -410,7 +410,7 @@ public class CSVFormat implements Serial
      *
      * @return A copy of this format using the specified output line separator
      */
-    public CSVFormat withLineSeparator(String lineSeparator) {
+    public CSVFormat withLineSeparator(final String lineSeparator) {
         return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces,
                 ignoreEmptyLines, lineSeparator, header);
     }
@@ -438,7 +438,7 @@ public class CSVFormat implements Serial
      *
      * @return A copy of this format using the specified header
      */
-    public CSVFormat withHeader(String... header) {
+    public CSVFormat withHeader(final String... header) {
         return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces,
                 ignoreEmptyLines, lineSeparator, header);
     }
@@ -449,7 +449,7 @@ public class CSVFormat implements Serial
      * @param in
      *            the input stream
      */
-    public Iterable<CSVRecord> parse(Reader in) throws IOException {
+    public Iterable<CSVRecord> parse(final Reader in) throws IOException {
         return new CSVParser(in, this);
     }
 
@@ -459,12 +459,12 @@ public class CSVFormat implements Serial
      * @param values
      *            the values to format
      */
-    public String format(String... values) {
-        StringWriter out = new StringWriter();
+    public String format(final String... values) {
+        final StringWriter out = new StringWriter();
         try {
             new CSVPrinter(out, this).println(values);
             return out.toString().trim();
-        } catch (IOException e) {
+        } catch (final IOException e) {
             // should not happen
             throw new IllegalStateException(e);
         }
@@ -472,7 +472,7 @@ public class CSVFormat implements Serial
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder();
+        final StringBuilder sb = new StringBuilder();
         sb.append("Delimiter=<").append(delimiter).append('>');
         if (isEscaping()) {
             sb.append(' ');

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java Thu Oct 11 15:47:44 2012
@@ -28,7 +28,7 @@ import java.io.IOException;
 class CSVLexer extends Lexer {
 
     // ctor needs to be public so can be called dynamically by PerformanceTest class
-    public CSVLexer(CSVFormat format, ExtendedBufferedReader in) {
+    public CSVLexer(final CSVFormat format, final ExtendedBufferedReader in) {
         super(format, in);
     }
 
@@ -44,7 +44,7 @@ class CSVLexer extends Lexer {
      *             on stream access error
      */
     @Override
-    Token nextToken(Token token) throws IOException {
+    Token nextToken(final Token token) throws IOException {
 
         // get the last read char (required for empty line detection)
         int lastChar = in.readAgain();
@@ -81,7 +81,7 @@ class CSVLexer extends Lexer {
         }
 
         if (isStartOfLine(lastChar) && isCommentStart(c)) {
-            String comment = in.readLine().trim();
+            final String comment = in.readLine().trim();
             token.content.append(comment);
             token.type = COMMENT;
             return token;
@@ -141,7 +141,7 @@ class CSVLexer extends Lexer {
      * @throws IOException
      *             on stream access error
      */
-    private Token simpleTokenLexer(Token tkn, int c) throws IOException {
+    private Token simpleTokenLexer(final Token tkn, int c) throws IOException {
         // Faster to use while(true)+break than while(tkn.type == INVALID)
         while (true) {
             if (isEndOfLine(c)) {
@@ -190,9 +190,9 @@ class CSVLexer extends Lexer {
      * @throws IOException
      *             on invalid state: EOF before closing encapsulator or invalid character before delimiter or EOL
      */
-    private Token encapsulatedTokenLexer(Token tkn) throws IOException {
+    private Token encapsulatedTokenLexer(final Token tkn) throws IOException {
         // save current line number in case needed for IOE
-        int startLineNumber = getLineNumber();
+        final int startLineNumber = getLineNumber();
         int c;
         while (true) {
             c = in.read();

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Thu Oct 11 15:47:44 2012
@@ -85,7 +85,7 @@ public class CSVParser implements Iterab
      * @throws IllegalArgumentException
      *             thrown if the parameters of the format are inconsistent
      */
-    public CSVParser(Reader input) throws IOException {
+    public CSVParser(final Reader input) throws IOException {
         this(input, CSVFormat.DEFAULT);
     }
 
@@ -99,7 +99,7 @@ public class CSVParser implements Iterab
      * @throws IllegalArgumentException
      *             thrown if the parameters of the format are inconsistent
      */
-    public CSVParser(Reader input, CSVFormat format) throws IOException {
+    public CSVParser(final Reader input, final CSVFormat format) throws IOException {
         format.validate();
 
         this.lexer = new CSVLexer(format, new ExtendedBufferedReader(input));
@@ -117,7 +117,7 @@ public class CSVParser implements Iterab
      * @throws IllegalArgumentException
      *             thrown if the parameters of the format are inconsistent
      */
-    public CSVParser(String input, CSVFormat format) throws IOException {
+    public CSVParser(final String input, final CSVFormat format) throws IOException {
         this(new StringReader(input), format);
     }
 
@@ -204,7 +204,7 @@ public class CSVParser implements Iterab
      *             on parse error or input read-failure
      */
     public List<CSVRecord> getRecords() throws IOException {
-        List<CSVRecord> records = new ArrayList<CSVRecord>();
+        final List<CSVRecord> records = new ArrayList<CSVRecord>();
         CSVRecord rec;
         while ((rec = getRecord()) != null) {
             records.add(rec);
@@ -215,7 +215,7 @@ public class CSVParser implements Iterab
     /**
      * Initializes the name to index mapping if the format defines a header.
      */
-    private Map<String, Integer> initializeHeader(CSVFormat format) throws IOException {
+    private Map<String, Integer> initializeHeader(final CSVFormat format) throws IOException {
         Map<String, Integer> hdrMap = null;
         if (format.getHeader() != null) {
             hdrMap = new LinkedHashMap<String, Integer>();
@@ -223,7 +223,7 @@ public class CSVParser implements Iterab
             String[] header = null;
             if (format.getHeader().length == 0) {
                 // read the header from the first line of the file
-                CSVRecord rec = getRecord();
+                final CSVRecord rec = getRecord();
                 if (rec != null) {
                     header = rec.values();
                 }
@@ -252,7 +252,7 @@ public class CSVParser implements Iterab
             private CSVRecord getNextRecord() {
                 try {
                     return getRecord();
-                } catch (IOException e) {
+                } catch (final IOException e) {
                     throw new RuntimeException(e);
                 }
             }

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java Thu Oct 11 15:47:44 2012
@@ -45,7 +45,7 @@ public class CSVPrinter {
      * @throws IllegalArgumentException
      *             thrown if the parameters of the format are inconsistent
      */
-    public CSVPrinter(Appendable out, CSVFormat format) {
+    public CSVPrinter(final Appendable out, final CSVFormat format) {
         this.out = out;
         this.format = format == null ? CSVFormat.DEFAULT : format;
         this.format.validate();
@@ -81,8 +81,8 @@ public class CSVPrinter {
      * @param values
      *            values to be outputted.
      */
-    public void println(String... values) throws IOException {
-        for (String value : values) {
+    public void println(final String... values) throws IOException {
+        for (final String value : values) {
             print(value);
         }
         println();
@@ -98,7 +98,7 @@ public class CSVPrinter {
      * @param comment
      *            the comment to output
      */
-    public void printComment(String comment) throws IOException {
+    public void printComment(final String comment) throws IOException {
         if (!format.isCommentingEnabled()) {
             return;
         }
@@ -108,7 +108,7 @@ public class CSVPrinter {
         out.append(format.getCommentStart());
         out.append(' ');
         for (int i = 0; i < comment.length(); i++) {
-            char c = comment.charAt(i);
+            final char c = comment.charAt(i);
             switch (c) {
             case '\r':
                 if (i + 1 < comment.length() && comment.charAt(i + 1) == '\n') {
@@ -128,7 +128,7 @@ public class CSVPrinter {
         println();
     }
 
-    private void print(CharSequence value, int offset, int len) throws IOException {
+    private void print(final CharSequence value, final int offset, final int len) throws IOException {
         if (format.isEncapsulating()) {
             printAndEncapsulate(value, offset, len);
         } else if (format.isEscaping()) {
@@ -147,15 +147,15 @@ public class CSVPrinter {
         }
     }
 
-    void printAndEscape(CharSequence value, int offset, int len) throws IOException {
+    void printAndEscape(final CharSequence value, final int offset, final int len) throws IOException {
         int start = offset;
         int pos = offset;
-        int end = offset + len;
+        final int end = offset + len;
 
         printSep();
 
-        char delim = format.getDelimiter();
-        char escape = format.getEscape();
+        final char delim = format.getDelimiter();
+        final char escape = format.getEscape();
 
         while (pos < end) {
             char c = value.charAt(pos);
@@ -185,17 +185,17 @@ public class CSVPrinter {
         }
     }
 
-    void printAndEncapsulate(CharSequence value, int offset, int len) throws IOException {
-        boolean first = newLine; // is this the first value on this line?
+    void printAndEncapsulate(final CharSequence value, final int offset, final int len) throws IOException {
+        final boolean first = newLine; // is this the first value on this line?
         boolean quote = false;
         int start = offset;
         int pos = offset;
-        int end = offset + len;
+        final int end = offset + len;
 
         printSep();
 
-        char delim = format.getDelimiter();
-        char encapsulator = format.getEncapsulator();
+        final char delim = format.getDelimiter();
+        final char encapsulator = format.getEncapsulator();
 
         if (len <= 0) {
             // always quote an empty token that is the first
@@ -252,7 +252,7 @@ public class CSVPrinter {
         // Pick up where we left off: pos should be positioned on the first character that caused
         // the need for encapsulation.
         while (pos < end) {
-            char c = value.charAt(pos);
+            final char c = value.charAt(pos);
             if (c == encapsulator) {
                 // write out the chunk up until this point
 
@@ -277,7 +277,7 @@ public class CSVPrinter {
      * @param value
      *            value to be outputted.
      */
-    public void print(String value, boolean checkForEscape) throws IOException {
+    public void print(String value, final boolean checkForEscape) throws IOException {
         if (value == null) {
             // null values are considered empty
             value = "";
@@ -298,7 +298,7 @@ public class CSVPrinter {
      * @param value
      *            value to be outputted.
      */
-    public void print(String value) throws IOException {
+    public void print(final String value) throws IOException {
         print(value, true);
     }
 }

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java Thu Oct 11 15:47:44 2012
@@ -40,7 +40,7 @@ public class CSVRecord implements Serial
     /** The accumulated comments (if any) */
     private final String comment;
 
-    CSVRecord(String[] values, Map<String, Integer> mapping, String comment) {
+    CSVRecord(final String[] values, final Map<String, Integer> mapping, final String comment) {
         this.values = values != null ? values : EMPTY_STRING_ARRAY;
         this.mapping = mapping;
         this.comment = comment;
@@ -52,7 +52,7 @@ public class CSVRecord implements Serial
      * @param i
      *            the index of the column retrieved
      */
-    public String get(int i) {
+    public String get(final int i) {
         return values[i];
     }
 
@@ -65,12 +65,12 @@ public class CSVRecord implements Serial
      * @throws IllegalStateException
      *             if no header mapping was provided
      */
-    public String get(String name) {
+    public String get(final String name) {
         if (mapping == null) {
             throw new IllegalStateException("No header mapping was specified, the record values can't be accessed by name");
         }
 
-        Integer index = mapping.get(name);
+        final Integer index = mapping.get(name);
 
         return index != null ? values[index.intValue()] : null;
     }
@@ -82,7 +82,7 @@ public class CSVRecord implements Serial
      *            the name of the column to be retrieved.
      * @return whether a given columns is mapped.
      */
-    public boolean isMapped(String name) {
+    public boolean isMapped(final String name) {
         return mapping != null ? mapping.containsKey(name) : false;
     }
     

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java Thu Oct 11 15:47:44 2012
@@ -48,13 +48,13 @@ class ExtendedBufferedReader extends Buf
     /**
      * Created extended buffered reader using default buffer-size
      */
-    ExtendedBufferedReader(Reader r) {
+    ExtendedBufferedReader(final Reader r) {
         super(r);
     }
 
     @Override
     public int read() throws IOException {
-        int current = super.read();
+        final int current = super.read();
         if (current == CR || (current == LF && lastChar != CR)) {
             lineCounter++;
         }
@@ -75,17 +75,17 @@ class ExtendedBufferedReader extends Buf
     }
 
     @Override
-    public int read(char[] buf, int offset, int length) throws IOException {
+    public int read(final char[] buf, final int offset, final int length) throws IOException {
         if (length == 0) {
             return 0;
         }
 
-        int len = super.read(buf, offset, length);
+        final int len = super.read(buf, offset, length);
 
         if (len > 0) {
 
             for (int i = offset; i < offset + len; i++) {
-                char ch = buf[i];
+                final char ch = buf[i];
                 if (ch == LF) {
                     if (CR != (i > 0 ? buf[i - 1] : lastChar)) {
                         lineCounter++;
@@ -116,7 +116,7 @@ class ExtendedBufferedReader extends Buf
      */
     @Override
     public String readLine() throws IOException {
-        String line = super.readLine();
+        final String line = super.readLine();
 
         if (line != null) {
             lastChar = LF; // needed for detecting start of line
@@ -139,7 +139,7 @@ class ExtendedBufferedReader extends Buf
      */
     int lookAhead() throws IOException {
         super.mark(1);
-        int c = super.read();
+        final int c = super.read();
         super.reset();
 
         return c;

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java Thu Oct 11 15:47:44 2012
@@ -41,7 +41,7 @@ abstract class Lexer {
     /** The input stream */
     final ExtendedBufferedReader in;
 
-    Lexer(CSVFormat format, ExtendedBufferedReader in) {
+    Lexer(final CSVFormat format, final ExtendedBufferedReader in) {
         this.format = format;
         this.in = in;
         this.isEncapsulating = format.isEncapsulating();
@@ -62,7 +62,7 @@ abstract class Lexer {
     // TODO escape handling needs more work
     int readEscape() throws IOException {
         // assume c is the escape char (normally a backslash)
-        int c = in.read();
+        final int c = in.read();
         switch (c) {
         case 'r':
             return '\r';
@@ -81,7 +81,7 @@ abstract class Lexer {
         }
     }
 
-    void trimTrailingSpaces(StringBuilder buffer) {
+    void trimTrailingSpaces(final StringBuilder buffer) {
         int length = buffer.length();
         while (length > 0 && Character.isWhitespace(buffer.charAt(length - 1))) {
             length = length - 1;
@@ -94,7 +94,7 @@ abstract class Lexer {
     /**
      * @return true if the given char is a whitespace character
      */
-    boolean isWhitespace(int c) {
+    boolean isWhitespace(final int c) {
         return c != format.getDelimiter() && Character.isWhitespace((char) c);
     }
 
@@ -118,32 +118,32 @@ abstract class Lexer {
      * @param c
      * @return true if the character is at the start of a line.
      */
-    boolean isStartOfLine(int c) {
+    boolean isStartOfLine(final int c) {
         return c == '\n' || c == '\r' || c == ExtendedBufferedReader.UNDEFINED;
     }
 
     /**
      * @return true if the given character indicates end of file
      */
-    boolean isEndOfFile(int c) {
+    boolean isEndOfFile(final int c) {
         return c == ExtendedBufferedReader.END_OF_STREAM;
     }
 
     abstract Token nextToken(Token reusableToken) throws IOException;
 
-    boolean isDelimiter(int c) {
+    boolean isDelimiter(final int c) {
         return c == delimiter;
     }
 
-    boolean isEscape(int c) {
+    boolean isEscape(final int c) {
         return isEscaping && c == escape;
     }
 
-    boolean isEncapsulator(int c) {
+    boolean isEncapsulator(final int c) {
         return isEncapsulating && c == encapsulator;
     }
 
-    boolean isCommentStart(int c) {
+    boolean isCommentStart(final int c) {
         return isCommentEnabled && c == commmentStart;
     }
 }

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java Thu Oct 11 15:47:44 2012
@@ -49,7 +49,7 @@ public class CSVFileParserTest {
     private final BufferedReader testData;
     private final String testName;
 
-    public CSVFileParserTest(File file) throws FileNotFoundException
+    public CSVFileParserTest(final File file) throws FileNotFoundException
     {
        this.testName = file.getName();
        this.testData = new BufferedReader(new FileReader(file));
@@ -66,15 +66,15 @@ public class CSVFileParserTest {
     @Parameters
     public static Collection<Object[]> generateData()
     {
-        List<Object[]> list = new ArrayList<Object[]>();
+        final List<Object[]> list = new ArrayList<Object[]>();
 
         final FilenameFilter filenameFilter = new FilenameFilter() {
-            public boolean accept(File dir, String name) {
+            public boolean accept(final File dir, final String name) {
                 return name.startsWith("test") && name.endsWith(".txt");
             }
         };
-        File[] files = BASE.listFiles(filenameFilter);
-        for(File f : files){
+        final File[] files = BASE.listFiles(filenameFilter);
+        for(final File f : files){
             list.add(new Object[]{f});
         }
         return list;
@@ -84,15 +84,15 @@ public class CSVFileParserTest {
     public void testCSVFile() throws Exception {
         String line = readTestData();
         assertNotNull("file must contain config line", line);
-        String[] split = line.split(" ");
+        final String[] split = line.split(" ");
         assertTrue(testName+" require 1 param", split.length >= 1);
          // first line starts with csv data file name
-        BufferedReader csvFile = new BufferedReader(new FileReader(new File(BASE, split[0])));
+        final BufferedReader csvFile = new BufferedReader(new FileReader(new File(BASE, split[0])));
         CSVFormat fmt = CSVFormat.PRISTINE.withDelimiter(',').withEncapsulator('"');
         boolean checkComments = false;
         for(int i=1; i < split.length; i++) {
             final String option = split[i];
-            String[] option_parts = option.split("=",2);
+            final String[] option_parts = option.split("=",2);
             if ("IgnoreEmpty".equalsIgnoreCase(option_parts[0])){
                 fmt = fmt.withIgnoreEmptyLines(Boolean.parseBoolean(option_parts[1]));
             } else if ("IgnoreSpaces".equalsIgnoreCase(option_parts[0])) {
@@ -109,7 +109,7 @@ public class CSVFileParserTest {
         assertEquals(testName+" Expected format ", line, fmt.toString());
 
         // Now parse the file and compare against the expected results
-        for(CSVRecord rec : fmt.parse(csvFile)) {
+        for(final CSVRecord rec : fmt.parse(csvFile)) {
             String parsed = rec.toString();
             if (checkComments) {
                 final String comment = rec.getComment().replace("\n", "\\n");
@@ -117,7 +117,7 @@ public class CSVFileParserTest {
                     parsed += "#" + comment;
                 }
             }
-            int count = rec.size();
+            final int count = rec.size();
             assertEquals(testName, readTestData(), count+":"+parsed);
         }
     }

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java Thu Oct 11 15:47:44 2012
@@ -34,7 +34,7 @@ public class CSVFormatTest {
 
     @Test
     public void testImmutalibity() {
-        CSVFormat format = new CSVFormat('!', '!', '!', '!', true, true, CSVFormat.CRLF, null);
+        final CSVFormat format = new CSVFormat('!', '!', '!', '!', true, true, CSVFormat.CRLF, null);
 
         format.withDelimiter('?');
         format.withEncapsulator('?');
@@ -56,7 +56,7 @@ public class CSVFormatTest {
 
     @Test
     public void testMutators() {
-        CSVFormat format = new CSVFormat('!', '!', '!', '!', true, true, CSVFormat.CRLF, null);
+        final CSVFormat format = new CSVFormat('!', '!', '!', '!', true, true, CSVFormat.CRLF, null);
 
         assertEquals('?', format.withDelimiter('?').getDelimiter());
         assertEquals('?', format.withEncapsulator('?').getEncapsulator());
@@ -70,7 +70,7 @@ public class CSVFormatTest {
 
     @Test
     public void testFormat() {
-        CSVFormat format = CSVFormat.DEFAULT;
+        final CSVFormat format = CSVFormat.DEFAULT;
 
         assertEquals("", format.format());
         assertEquals("a,b,c", format.format("a", "b", "c"));
@@ -79,54 +79,54 @@ public class CSVFormatTest {
 
     @Test
     public void testValidation() {
-        CSVFormat format = CSVFormat.DEFAULT;
+        final CSVFormat format = CSVFormat.DEFAULT;
 
         try {
             format.withDelimiter('\n');
             fail();
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected
         }
 
         try {
             format.withEscape('\r');
             fail();
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected
         }
 
         try {
             format.withEncapsulator('\n');
             fail();
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected
         }
 
         try {
             format.withCommentStart('\r');
             fail();
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected
         }
 
         try {
             format.withDelimiter('!').withEscape('!').validate();
             fail();
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected
         }
 
         try {
             format.withDelimiter('!').withCommentStart('!').validate();
             fail();
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected
         }
 
         try {
             format.withEncapsulator('!').withCommentStart('!').validate();
             fail();
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected
         }
 
@@ -135,7 +135,7 @@ public class CSVFormatTest {
         try {
             format.withEscape('!').withCommentStart('!').validate();
             fail();
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected
         }
 
@@ -145,7 +145,7 @@ public class CSVFormatTest {
         try {
             format.withEncapsulator('!').withDelimiter('!').validate();
             fail();
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // expected
         }
     }
@@ -153,15 +153,15 @@ public class CSVFormatTest {
     @SuppressWarnings("boxing") // no need to worry about boxing here
     @Test
     public void testSerialization() throws Exception {
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        final ByteArrayOutputStream out = new ByteArrayOutputStream();
 
-        ObjectOutputStream oos = new ObjectOutputStream(out);
+        final ObjectOutputStream oos = new ObjectOutputStream(out);
         oos.writeObject(CSVFormat.DEFAULT);
         oos.flush();
         oos.close();
 
-        ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(out.toByteArray()));
-        CSVFormat format = (CSVFormat) in.readObject();
+        final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(out.toByteArray()));
+        final CSVFormat format = (CSVFormat) in.readObject();
 
         assertNotNull(format);
         assertEquals("delimiter", CSVFormat.DEFAULT.getDelimiter(), format.getDelimiter());

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java Thu Oct 11 15:47:44 2012
@@ -28,7 +28,7 @@ class CSVLexer1 extends Lexer {
     private final StringBuilder wsBuf = new StringBuilder();
 
     // ctor needs to be public so can be called dynamically by PerformanceTest class
-    public CSVLexer1(CSVFormat format, ExtendedBufferedReader in) {
+    public CSVLexer1(final CSVFormat format, final ExtendedBufferedReader in) {
         super(format, in);
     }
 
@@ -143,7 +143,7 @@ class CSVLexer1 extends Lexer {
      * @return the filled token
      * @throws IOException on stream access error
      */
-    private Token simpleTokenLexer(Token tkn, int c) throws IOException {
+    private Token simpleTokenLexer(final Token tkn, int c) throws IOException {
         while (true) {
             if (isEndOfLine(c)) {
                 // end of record
@@ -189,9 +189,9 @@ class CSVLexer1 extends Lexer {
      * @return a valid token object
      * @throws IOException on invalid state
      */
-    private Token encapsulatedTokenLexer(Token tkn, int c) throws IOException {
+    private Token encapsulatedTokenLexer(final Token tkn, int c) throws IOException {
         // save current line
-        int startLineNumber = getLineNumber();
+        final int startLineNumber = getLineNumber();
         // ignore the given delimiter
         // assert c == delimiter;
         while (true) {

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java Thu Oct 11 15:47:44 2012
@@ -28,7 +28,7 @@ import java.io.IOException;
 class CSVLexer1306663 extends Lexer {
 
     // ctor needs to be public so can be called dynamically by PerformanceTest class
-    public CSVLexer1306663(CSVFormat format, ExtendedBufferedReader in) {
+    public CSVLexer1306663(final CSVFormat format, final ExtendedBufferedReader in) {
         super(format, in);
     }
 
@@ -42,7 +42,7 @@ class CSVLexer1306663 extends Lexer {
      * @throws java.io.IOException on stream access error
      */
     @Override
-    Token nextToken(Token tkn) throws IOException {
+    Token nextToken(final Token tkn) throws IOException {
 
         // get the last read char (required for empty line detection)
         int lastChar = in.readAgain();
@@ -139,7 +139,7 @@ class CSVLexer1306663 extends Lexer {
      * @return the filled token
      * @throws IOException on stream access error
      */
-    private Token simpleTokenLexer(Token tkn, int c) throws IOException {
+    private Token simpleTokenLexer(final Token tkn, int c) throws IOException {
         // Faster to use while(true)+break than while(tkn.type == INVALID)
         while (true) {
             if (isEndOfLine(c)) {
@@ -180,9 +180,9 @@ class CSVLexer1306663 extends Lexer {
      * @return a valid token object
      * @throws IOException on invalid state
      */
-    private Token encapsulatedTokenLexer(Token tkn) throws IOException {
+    private Token encapsulatedTokenLexer(final Token tkn) throws IOException {
         // save current line
-        int startLineNumber = getLineNumber();
+        final int startLineNumber = getLineNumber();
         // ignore the given delimiter
         // assert c == delimiter;
         int c;

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java Thu Oct 11 15:47:44 2012
@@ -28,7 +28,7 @@ import java.io.IOException;
 class CSVLexer1306667 extends Lexer {
 
     // ctor needs to be public so can be called dynamically by PerformanceTest class
-    public CSVLexer1306667(CSVFormat format, ExtendedBufferedReader in) {
+    public CSVLexer1306667(final CSVFormat format, final ExtendedBufferedReader in) {
         super(format, in);
     }
 
@@ -42,7 +42,7 @@ class CSVLexer1306667 extends Lexer {
      * @throws java.io.IOException on stream access error
      */
     @Override
-    Token nextToken(Token tkn) throws IOException {
+    Token nextToken(final Token tkn) throws IOException {
 
         // get the last read char (required for empty line detection)
         int lastChar = in.readAgain();
@@ -139,7 +139,7 @@ class CSVLexer1306667 extends Lexer {
      * @return the filled token
      * @throws IOException on stream access error
      */
-    private Token simpleTokenLexer(Token tkn, int c) throws IOException {
+    private Token simpleTokenLexer(final Token tkn, int c) throws IOException {
         // Faster to use while(true)+break than while(tkn.type == INVALID)
         while (true) {
             if (isEndOfLine(c)) {
@@ -180,9 +180,9 @@ class CSVLexer1306667 extends Lexer {
      * @return a valid token object
      * @throws IOException on invalid state
      */
-    private Token encapsulatedTokenLexer(Token tkn) throws IOException {
+    private Token encapsulatedTokenLexer(final Token tkn) throws IOException {
         // save current line
-        int startLineNumber = getLineNumber();
+        final int startLineNumber = getLineNumber();
         // ignore the given delimiter
         // assert c == delimiter;
         int c;

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer3.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer3.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer3.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer3.java Thu Oct 11 15:47:44 2012
@@ -36,7 +36,7 @@ class CSVLexer3 extends Lexer {
     private final char escape;
 
     // ctor needs to be public so can be called dynamically by PerformanceTest class
-    public CSVLexer3(CSVFormat format, ExtendedBufferedReader in) {
+    public CSVLexer3(final CSVFormat format, final ExtendedBufferedReader in) {
         super(format, in);
         this.escape = format.getEscape();
     }
@@ -55,7 +55,7 @@ class CSVLexer3 extends Lexer {
         EOFCHAR
     }
 
-    private CharType classify(int intch) {
+    private CharType classify(final int intch) {
         if (isDelimiter(intch)) {
             return CharType.DELIM;
         }
@@ -97,14 +97,14 @@ class CSVLexer3 extends Lexer {
      * @throws java.io.IOException on stream access error
      */
     @Override
-    Token nextToken(Token tkn) throws IOException {
+    Token nextToken(final Token tkn) throws IOException {
 
         State state = State.BEGIN;
         int intch;
         boolean trimTrailingSpaces = false;
         while(tkn.type == INVALID) {
             intch = in.read();
-            CharType type = classify(intch);
+            final CharType type = classify(intch);
             switch(state) {
                 case BEGIN:
                     switch(type){

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java Thu Oct 11 15:47:44 2012
@@ -33,11 +33,11 @@ import org.junit.Test;
 
 public class CSVLexerTest {
 
-    private Lexer getLexer(String input, CSVFormat format) {
+    private Lexer getLexer(final String input, final CSVFormat format) {
         return new CSVLexer(format, new ExtendedBufferedReader(new StringReader(input)));
     }
 
-    private void assertTokenEquals(Token.Type expectedType, String expectedContent, Token token) {
+    private void assertTokenEquals(final Token.Type expectedType, final String expectedContent, final Token token) {
         assertEquals("Token type", expectedType, token.type);
         assertEquals("Token content", expectedContent, token.content.toString());
     }
@@ -45,8 +45,8 @@ public class CSVLexerTest {
     // Single line (without comment)
     @Test
     public void testNextToken1() throws IOException {
-        String code = "abc,def, hijk,  lmnop,   qrst,uv ,wxy   ,z , ,";
-        Lexer parser = getLexer(code, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true));
+        final String code = "abc,def, hijk,  lmnop,   qrst,uv ,wxy   ,z , ,";
+        final Lexer parser = getLexer(code, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true));
         assertTokenEquals(TOKEN, "abc", parser.nextToken(new Token()));
         assertTokenEquals(TOKEN, "def", parser.nextToken(new Token()));
         assertTokenEquals(TOKEN, "hijk", parser.nextToken(new Token()));
@@ -78,10 +78,10 @@ public class CSVLexerTest {
                 "\n"+
                 "\n"+
                 "# Final comment\n";       // 7
-        CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#');
+        final CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#');
         assertTrue("Should ignore empty lines", format.getIgnoreEmptyLines());
 
-        Lexer parser = getLexer(code, format);
+        final Lexer parser = getLexer(code, format);
 
 
         assertTokenEquals(TOKEN, "1", parser.nextToken(new Token()));
@@ -121,10 +121,10 @@ public class CSVLexerTest {
                 "\n"+                      // 6b
                 "\n"+                      // 6c
                 "# Final comment\n";       // 7
-        CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#').withIgnoreEmptyLines(false);
+        final CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#').withIgnoreEmptyLines(false);
         assertFalse("Should not ignore empty lines", format.getIgnoreEmptyLines());
 
-        Lexer parser = getLexer(code, format);
+        final Lexer parser = getLexer(code, format);
 
 
         assertTokenEquals(TOKEN, "1", parser.nextToken(new Token()));
@@ -159,10 +159,10 @@ public class CSVLexerTest {
         /* file: a,\,,b
         *       \,,
         */
-        String code = "a,\\,,b\\\n\\,,";
-        CSVFormat format = CSVFormat.DEFAULT;
+        final String code = "a,\\,,b\\\n\\,,";
+        final CSVFormat format = CSVFormat.DEFAULT;
         assertFalse(format.isEscaping());
-        Lexer parser = getLexer(code, format);
+        final Lexer parser = getLexer(code, format);
 
         assertTokenEquals(TOKEN, "a", parser.nextToken(new Token()));
         // an unquoted single backslash is not an escape char
@@ -181,10 +181,10 @@ public class CSVLexerTest {
         /* file: a,\,,b
         *       \,,
         */
-        String code = "a,\\,,b\\\\\n\\,,\\\nc,d\\\r\ne";
-        CSVFormat format = CSVFormat.DEFAULT.withEscape('\\').withIgnoreEmptyLines(false);
+        final String code = "a,\\,,b\\\\\n\\,,\\\nc,d\\\r\ne";
+        final CSVFormat format = CSVFormat.DEFAULT.withEscape('\\').withIgnoreEmptyLines(false);
         assertTrue(format.isEscaping());
-        Lexer parser = getLexer(code, format);
+        final Lexer parser = getLexer(code, format);
 
         assertTokenEquals(TOKEN, "a", parser.nextToken(new Token()));
         assertTokenEquals(TOKEN, ",", parser.nextToken(new Token()));
@@ -198,17 +198,17 @@ public class CSVLexerTest {
     // simple token with escaping enabled
     @Test
     public void testNextToken3BadEscaping() throws IOException {
-        String code = "a,b,c\\";
-        CSVFormat format = CSVFormat.DEFAULT.withEscape('\\');
+        final String code = "a,b,c\\";
+        final CSVFormat format = CSVFormat.DEFAULT.withEscape('\\');
         assertTrue(format.isEscaping());
-        Lexer parser = getLexer(code, format);
+        final Lexer parser = getLexer(code, format);
 
         assertTokenEquals(TOKEN, "a", parser.nextToken(new Token()));
         assertTokenEquals(TOKEN, "b", parser.nextToken(new Token()));
         try {
-            Token tkn = parser.nextToken(new Token());
+            final Token tkn = parser.nextToken(new Token());
             fail("Expected IOE, found "+tkn);
-        } catch (IOException e) {
+        } catch (final IOException e) {
         }
     }
 
@@ -220,8 +220,8 @@ public class CSVLexerTest {
         *        a,"foo "   ,b     // whitespace after closing encapsulator
         *        a,  " foo " ,b
         */
-        String code = "a,\"foo\",b\na,   \" foo\",b\na,\"foo \"  ,b\na,  \" foo \"  ,b";
-        Lexer parser = getLexer(code, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true));
+        final String code = "a,\"foo\",b\na,   \" foo\",b\na,\"foo \"  ,b\na,  \" foo \"  ,b";
+        final Lexer parser = getLexer(code, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true));
         assertTokenEquals(TOKEN, "a", parser.nextToken(new Token()));
         assertTokenEquals(TOKEN, "foo", parser.nextToken(new Token()));
         assertTokenEquals(EORECORD, "b", parser.nextToken(new Token()));
@@ -240,8 +240,8 @@ public class CSVLexerTest {
     // encapsulator tokenizer (multi line, delimiter in string)
     @Test
     public void testNextToken5() throws IOException {
-        String code = "a,\"foo\n\",b\n\"foo\n  baar ,,,\"\n\"\n\t \n\"";
-        Lexer parser = getLexer(code, CSVFormat.DEFAULT);
+        final String code = "a,\"foo\n\",b\n\"foo\n  baar ,,,\"\n\"\n\t \n\"";
+        final Lexer parser = getLexer(code, CSVFormat.DEFAULT);
         assertTokenEquals(TOKEN, "a", parser.nextToken(new Token()));
         assertTokenEquals(TOKEN, "foo\n", parser.nextToken(new Token()));
         assertTokenEquals(EORECORD, "b", parser.nextToken(new Token()));
@@ -258,9 +258,9 @@ public class CSVLexerTest {
         *       !comment;;;;
         *       ;;
         */
-        String code = "a;'b and '' more\n'\n!comment;;;;\n;;";
-        CSVFormat format = CSVFormat.DEFAULT.withDelimiter(';').withEncapsulator('\'').withCommentStart('!');
-        Lexer parser = getLexer(code, format);
+        final String code = "a;'b and '' more\n'\n!comment;;;;\n;;";
+        final CSVFormat format = CSVFormat.DEFAULT.withDelimiter(';').withEncapsulator('\'').withCommentStart('!');
+        final Lexer parser = getLexer(code, format);
         assertTokenEquals(TOKEN, "a", parser.nextToken(new Token()));
         assertTokenEquals(EORECORD, "b and ' more\n", parser.nextToken(new Token()));
     }
@@ -268,8 +268,8 @@ public class CSVLexerTest {
     // From CSV-1
     @Test
     public void testDelimiterIsWhitespace() throws IOException {
-        String code = "one\ttwo\t\tfour \t five\t six";
-        Lexer parser = getLexer(code, CSVFormat.TDF);
+        final String code = "one\ttwo\t\tfour \t five\t six";
+        final Lexer parser = getLexer(code, CSVFormat.TDF);
         assertTokenEquals(TOKEN, "one", parser.nextToken(new Token()));
         assertTokenEquals(TOKEN, "two", parser.nextToken(new Token()));
         assertTokenEquals(TOKEN, "", parser.nextToken(new Token()));

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Thu Oct 11 15:47:44 2012
@@ -65,8 +65,8 @@ public class CSVParserTest {
 
     @Test
     public void testGetLine() throws IOException {
-        CSVParser parser = new CSVParser(new StringReader(CSVINPUT), CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true));
-        for (String[] re : RESULT) {
+        final CSVParser parser = new CSVParser(new StringReader(CSVINPUT), CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true));
+        for (final String[] re : RESULT) {
             assertArrayEquals(re, parser.getRecord().values());
         }
 
@@ -75,8 +75,8 @@ public class CSVParserTest {
 
     @Test
     public void testGetRecords() throws IOException {
-        CSVParser parser = new CSVParser(new StringReader(CSVINPUT), CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true));
-        List<CSVRecord> records = parser.getRecords();
+        final CSVParser parser = new CSVParser(new StringReader(CSVINPUT), CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true));
+        final List<CSVRecord> records = parser.getRecords();
         assertEquals(RESULT.length, records.size());
         assertTrue(records.size() > 0);
         for (int i = 0; i < RESULT.length; i++) {
@@ -86,18 +86,18 @@ public class CSVParserTest {
 
     @Test
     public void testExcelFormat1() throws IOException {
-        String code =
+        final String code =
                 "value1,value2,value3,value4\r\na,b,c,d\r\n  x,,,"
                         + "\r\n\r\n\"\"\"hello\"\"\",\"  \"\"world\"\"\",\"abc\ndef\",\r\n";
-        String[][] res = {
+        final String[][] res = {
                 {"value1", "value2", "value3", "value4"},
                 {"a", "b", "c", "d"},
                 {"  x", "", "", ""},
                 {""},
                 {"\"hello\"", "  \"world\"", "abc\ndef", ""}
         };
-        CSVParser parser = new CSVParser(code, CSVFormat.EXCEL);
-        List<CSVRecord> records = parser.getRecords();
+        final CSVParser parser = new CSVParser(code, CSVFormat.EXCEL);
+        final List<CSVRecord> records = parser.getRecords();
         assertEquals(res.length, records.size());
         assertTrue(records.size() > 0);
         for (int i = 0; i < res.length; i++) {
@@ -107,16 +107,16 @@ public class CSVParserTest {
 
     @Test
     public void testExcelFormat2() throws Exception {
-        String code = "foo,baar\r\n\r\nhello,\r\n\r\nworld,\r\n";
-        String[][] res = {
+        final String code = "foo,baar\r\n\r\nhello,\r\n\r\nworld,\r\n";
+        final String[][] res = {
                 {"foo", "baar"},
                 {""},
                 {"hello", ""},
                 {""},
                 {"world", ""}
         };
-        CSVParser parser = new CSVParser(code, CSVFormat.EXCEL);
-        List<CSVRecord> records = parser.getRecords();
+        final CSVParser parser = new CSVParser(code, CSVFormat.EXCEL);
+        final List<CSVRecord> records = parser.getRecords();
         assertEquals(res.length, records.size());
         assertTrue(records.size() > 0);
         for (int i = 0; i < res.length; i++) {
@@ -126,7 +126,7 @@ public class CSVParserTest {
 
     @Test
     public void testEndOfFileBehaviourExcel() throws Exception {
-        String[] codes = {
+        final String[] codes = {
                 "hello,\r\n\r\nworld,\r\n",
                 "hello,\r\n\r\nworld,",
                 "hello,\r\n\r\nworld,\"\"\r\n",
@@ -136,15 +136,15 @@ public class CSVParserTest {
                 "hello,\r\n\r\nworld,\"\"\n",
                 "hello,\r\n\r\nworld,\"\""
         };
-        String[][] res = {
+        final String[][] res = {
                 {"hello", ""},
                 {""},  // Excel format does not ignore empty lines
                 {"world", ""}
         };
 
-        for (String code : codes) {
-            CSVParser parser = new CSVParser(code, CSVFormat.EXCEL);
-            List<CSVRecord> records = parser.getRecords();
+        for (final String code : codes) {
+            final CSVParser parser = new CSVParser(code, CSVFormat.EXCEL);
+            final List<CSVRecord> records = parser.getRecords();
             assertEquals(res.length, records.size());
             assertTrue(records.size() > 0);
             for (int i = 0; i < res.length; i++) {
@@ -155,7 +155,7 @@ public class CSVParserTest {
 
     @Test
     public void testEndOfFileBehaviorCSV() throws Exception {
-        String[] codes = {
+        final String[] codes = {
                 "hello,\r\n\r\nworld,\r\n",
                 "hello,\r\n\r\nworld,",
                 "hello,\r\n\r\nworld,\"\"\r\n",
@@ -165,13 +165,13 @@ public class CSVParserTest {
                 "hello,\r\n\r\nworld,\"\"\n",
                 "hello,\r\n\r\nworld,\"\""
         };
-        String[][] res = {
+        final String[][] res = {
                 {"hello", ""},  // CSV format ignores empty lines
                 {"world", ""}
         };
-        for (String code : codes) {
-            CSVParser parser = new CSVParser(new StringReader(code));
-            List<CSVRecord> records = parser.getRecords();
+        for (final String code : codes) {
+            final CSVParser parser = new CSVParser(new StringReader(code));
+            final List<CSVRecord> records = parser.getRecords();
             assertEquals(res.length, records.size());
             assertTrue(records.size() > 0);
             for (int i = 0; i < res.length; i++) {
@@ -182,20 +182,20 @@ public class CSVParserTest {
 
     @Test
     public void testEmptyLineBehaviourExcel() throws Exception {
-        String[] codes = {
+        final String[] codes = {
                 "hello,\r\n\r\n\r\n",
                 "hello,\n\n\n",
                 "hello,\"\"\r\n\r\n\r\n",
                 "hello,\"\"\n\n\n"
         };
-        String[][] res = {
+        final String[][] res = {
                 {"hello", ""},
                 {""},  // Excel format does not ignore empty lines
                 {""}
         };
-        for (String code : codes) {
-            CSVParser parser = new CSVParser(code, CSVFormat.EXCEL);
-            List<CSVRecord> records = parser.getRecords();
+        for (final String code : codes) {
+            final CSVParser parser = new CSVParser(code, CSVFormat.EXCEL);
+            final List<CSVRecord> records = parser.getRecords();
             assertEquals(res.length, records.size());
             assertTrue(records.size() > 0);
             for (int i = 0; i < res.length; i++) {
@@ -206,18 +206,18 @@ public class CSVParserTest {
 
     @Test
     public void testEmptyLineBehaviourCSV() throws Exception {
-        String[] codes = {
+        final String[] codes = {
                 "hello,\r\n\r\n\r\n",
                 "hello,\n\n\n",
                 "hello,\"\"\r\n\r\n\r\n",
                 "hello,\"\"\n\n\n"
         };
-        String[][] res = {
+        final String[][] res = {
                 {"hello", ""}  // CSV format ignores empty lines
         };
-        for (String code : codes) {
-            CSVParser parser = new CSVParser(new StringReader(code));
-            List<CSVRecord> records = parser.getRecords();
+        for (final String code : codes) {
+            final CSVParser parser = new CSVParser(new StringReader(code));
+            final List<CSVRecord> records = parser.getRecords();
             assertEquals(res.length, records.size());
             assertTrue(records.size() > 0);
             for (int i = 0; i < res.length; i++) {
@@ -228,14 +228,14 @@ public class CSVParserTest {
 
     @Test
     public void testEmptyFile() throws Exception {
-        CSVParser parser = new CSVParser("", CSVFormat.DEFAULT);
+        final CSVParser parser = new CSVParser("", CSVFormat.DEFAULT);
         assertNull(parser.getRecord());
     }
 
     @Test
     public void testCSV57() throws Exception {
-        CSVParser parser = new CSVParser("", CSVFormat.DEFAULT);
-        List<CSVRecord> l = parser.getRecords();
+        final CSVParser parser = new CSVParser("", CSVFormat.DEFAULT);
+        final List<CSVRecord> l = parser.getRecords();
         assertNotNull(l);
         assertEquals(0, l.size());
     }
@@ -243,7 +243,7 @@ public class CSVParserTest {
     @Test
     @Ignore
     public void testBackslashEscapingOld() throws IOException {
-        String code =
+        final String code =
                 "one,two,three\n"
                         + "on\\\"e,two\n"
                         + "on\"e,two\n"
@@ -253,7 +253,7 @@ public class CSVParserTest {
                         + "\"a\\\\\"\n"
                         + "a\\,b\n"
                         + "\"a\\\\,b\"";
-        String[][] res = {
+        final String[][] res = {
                 {"one", "two", "three"},
                 {"on\\\"e", "two"},
                 {"on\"e", "two"},
@@ -264,8 +264,8 @@ public class CSVParserTest {
                 {"a\\", "b"},  // a backslash must be returnd
                 {"a\\\\,b"}    // backslash in quotes only escapes a delimiter (",")
         };
-        CSVParser parser = new CSVParser(new StringReader(code));
-        List<CSVRecord> records = parser.getRecords();
+        final CSVParser parser = new CSVParser(new StringReader(code));
+        final List<CSVRecord> records = parser.getRecords();
         assertEquals(res.length, records.size());
         assertTrue(records.size() > 0);
         for (int i = 0; i < res.length; i++) {
@@ -280,7 +280,7 @@ public class CSVParserTest {
         // We will test with a forward slash as the escape char, and a single
         // quote as the encapsulator.
 
-        String code =
+        final String code =
                 "one,two,three\n" // 0
                         + "'',''\n"       // 1) empty encapsulators
                         + "/',/'\n"       // 2) single encapsulators
@@ -292,7 +292,7 @@ public class CSVParserTest {
                         + "   8   ,   \"quoted \"\" /\" // string\"   \n"     // don't eat spaces
                         + "9,   /\n   \n"  // escaped newline
                         + "";
-        String[][] res = {
+        final String[][] res = {
                 {"one", "two", "three"}, // 0
                 {"", ""},                // 1
                 {"'", "'"},              // 2
@@ -306,11 +306,11 @@ public class CSVParserTest {
         };
 
 
-        CSVFormat format = CSVFormat.PRISTINE.withDelimiter(',').withEncapsulator('\'').withEscape('/')
+        final CSVFormat format = CSVFormat.PRISTINE.withDelimiter(',').withEncapsulator('\'').withEscape('/')
                                .withIgnoreEmptyLines(true).withLineSeparator(CSVFormat.CRLF);
 
-        CSVParser parser = new CSVParser(code, format);
-        List<CSVRecord> records = parser.getRecords();
+        final CSVParser parser = new CSVParser(code, format);
+        final List<CSVRecord> records = parser.getRecords();
         assertTrue(records.size() > 0);
         for (int i = 0; i < res.length; i++) {
             assertArrayEquals(res[i], records.get(i).values());
@@ -324,23 +324,23 @@ public class CSVParserTest {
         // We will test with a forward slash as the escape char, and a single
         // quote as the encapsulator.
 
-        String code = ""
+        final String code = ""
                 + " , , \n"           // 1)
                 + " \t ,  , \n"       // 2)
                 + " // , /, , /,\n"   // 3)
                 + "";
-        String[][] res = {
+        final String[][] res = {
                 {" ", " ", " "},         // 1
                 {" \t ", "  ", " "},     // 2
                 {" / ", " , ", " ,"},    // 3
         };
 
 
-        CSVFormat format = CSVFormat.PRISTINE.withDelimiter(',').withEscape('/')
+        final CSVFormat format = CSVFormat.PRISTINE.withDelimiter(',').withEscape('/')
                 .withIgnoreEmptyLines(true).withLineSeparator(CSVFormat.CRLF);
 
-        CSVParser parser = new CSVParser(code, format);
-        List<CSVRecord> records = parser.getRecords();
+        final CSVParser parser = new CSVParser(code, format);
+        final List<CSVRecord> records = parser.getRecords();
         assertTrue(records.size() > 0);
 
         Utils.compare("", res, records);
@@ -348,13 +348,13 @@ public class CSVParserTest {
 
     @Test
     public void testDefaultFormat() throws IOException {
-        String code = ""
+        final String code = ""
                 + "a,b#\n"           // 1)
                 + "\"\n\",\" \",#\n"   // 2)
                 + "#,\"\"\n"         // 3)
                 + "# Final comment\n"// 4)
                 ;
-        String[][] res = {
+        final String[][] res = {
                 {"a", "b#"},
                 {"\n", " ", "#"},
                 {"#", ""},
@@ -370,7 +370,7 @@ public class CSVParserTest {
 
         Utils.compare("Failed to parse without comments", res, records);
 
-        String[][] res_comments = {
+        final String[][] res_comments = {
                 {"a", "b#"},
                 {"\n", " ", "#"},
         };
@@ -384,45 +384,45 @@ public class CSVParserTest {
 
     @Test
     public void testCarriageReturnLineFeedEndings() throws IOException {
-        String code = "foo\r\nbaar,\r\nhello,world\r\n,kanu";
-        CSVParser parser = new CSVParser(new StringReader(code));
-        List<CSVRecord> records = parser.getRecords();
+        final String code = "foo\r\nbaar,\r\nhello,world\r\n,kanu";
+        final CSVParser parser = new CSVParser(new StringReader(code));
+        final List<CSVRecord> records = parser.getRecords();
         assertEquals(4, records.size());
     }
 
     @Test
     public void testCarriageReturnEndings() throws IOException {
-        String code = "foo\rbaar,\rhello,world\r,kanu";
-        CSVParser parser = new CSVParser(new StringReader(code));
-        List<CSVRecord> records = parser.getRecords();
+        final String code = "foo\rbaar,\rhello,world\r,kanu";
+        final CSVParser parser = new CSVParser(new StringReader(code));
+        final List<CSVRecord> records = parser.getRecords();
         assertEquals(4, records.size());
     }
 
     @Test
     public void testLineFeedEndings() throws IOException {
-        String code = "foo\nbaar,\nhello,world\n,kanu";
-        CSVParser parser = new CSVParser(new StringReader(code));
-        List<CSVRecord> records = parser.getRecords();
+        final String code = "foo\nbaar,\nhello,world\n,kanu";
+        final CSVParser parser = new CSVParser(new StringReader(code));
+        final List<CSVRecord> records = parser.getRecords();
         assertEquals(4, records.size());
     }
 
     @Test
     public void testIgnoreEmptyLines() throws IOException {
-        String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n";
+        final String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n";
         //String code = "world\r\n\n";
         //String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n";
-        CSVParser parser = new CSVParser(new StringReader(code));
-        List<CSVRecord> records = parser.getRecords();
+        final CSVParser parser = new CSVParser(new StringReader(code));
+        final List<CSVRecord> records = parser.getRecords();
         assertEquals(3, records.size());
     }
 
     @Test
     public void testForEach() throws Exception {
-        List<CSVRecord> records = new ArrayList<CSVRecord>();
+        final List<CSVRecord> records = new ArrayList<CSVRecord>();
 
-        Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");
+        final Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");
 
-        for (CSVRecord record : CSVFormat.DEFAULT.parse(in)) {
+        for (final CSVRecord record : CSVFormat.DEFAULT.parse(in)) {
             records.add(record);
         }
 
@@ -434,15 +434,15 @@ public class CSVParserTest {
 
     @Test
     public void testIterator() throws Exception {
-        Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");
+        final Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");
 
-        Iterator<CSVRecord> iterator = CSVFormat.DEFAULT.parse(in).iterator();
+        final Iterator<CSVRecord> iterator = CSVFormat.DEFAULT.parse(in).iterator();
 
         assertTrue(iterator.hasNext());
         try {
             iterator.remove();
             fail("expected UnsupportedOperationException");
-        } catch (UnsupportedOperationException expected) {
+        } catch (final UnsupportedOperationException expected) {
         }
         assertArrayEquals(new String[]{"a", "b", "c"}, iterator.next().values());
         assertArrayEquals(new String[]{"1", "2", "3"}, iterator.next().values());
@@ -455,20 +455,20 @@ public class CSVParserTest {
         try {
             iterator.next();
             fail("NoSuchElementException expected");
-        } catch (NoSuchElementException e) {
+        } catch (final NoSuchElementException e) {
             // expected
         }
     }
 
     @Test
     public void testHeader() throws Exception {
-        Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");
+        final Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");
 
-        Iterator<CSVRecord> records = CSVFormat.DEFAULT.withHeader().parse(in).iterator();
+        final Iterator<CSVRecord> records = CSVFormat.DEFAULT.withHeader().parse(in).iterator();
 
         for (int i = 0; i < 2; i++) {
             assertTrue(records.hasNext());
-            CSVRecord record = records.next();
+            final CSVRecord record = records.next();
             assertEquals(record.get(0), record.get("a"));
             assertEquals(record.get(1), record.get("b"));
             assertEquals(record.get(2), record.get("c"));
@@ -479,13 +479,13 @@ public class CSVParserTest {
 
     @Test
     public void testHeaderComment() throws Exception {
-        Reader in = new StringReader("# comment\na,b,c\n1,2,3\nx,y,z");
+        final Reader in = new StringReader("# comment\na,b,c\n1,2,3\nx,y,z");
 
-        Iterator<CSVRecord> records = CSVFormat.DEFAULT.withCommentStart('#').withHeader().parse(in).iterator();
+        final Iterator<CSVRecord> records = CSVFormat.DEFAULT.withCommentStart('#').withHeader().parse(in).iterator();
 
         for (int i = 0; i < 2; i++) {
             assertTrue(records.hasNext());
-            CSVRecord record = records.next();
+            final CSVRecord record = records.next();
             assertEquals(record.get(0), record.get("a"));
             assertEquals(record.get(1), record.get("b"));
             assertEquals(record.get(2), record.get("c"));
@@ -496,13 +496,13 @@ public class CSVParserTest {
 
     @Test
     public void testProvidedHeader() throws Exception {
-        Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");
+        final Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");
 
-        Iterator<CSVRecord> records = CSVFormat.DEFAULT.withHeader("A", "B", "C").parse(in).iterator();
+        final Iterator<CSVRecord> records = CSVFormat.DEFAULT.withHeader("A", "B", "C").parse(in).iterator();
 
         for (int i = 0; i < 3; i++) {
             assertTrue(records.hasNext());
-            CSVRecord record = records.next();
+            final CSVRecord record = records.next();
             assertTrue(record.isMapped("A"));
             assertTrue(record.isMapped("B"));
             assertTrue(record.isMapped("C"));
@@ -523,12 +523,12 @@ public class CSVParserTest {
         Assert.assertEquals("A", columnNames.next());
         Assert.assertEquals("B", columnNames.next());
         Assert.assertEquals("C", columnNames.next());
-        Iterator<CSVRecord> records = parser.iterator();
+        final Iterator<CSVRecord> records = parser.iterator();
         
         // Parse to make sure getHeaderMap did not have a side-effect.
         for (int i = 0; i < 3; i++) {
             assertTrue(records.hasNext());
-            CSVRecord record = records.next();
+            final CSVRecord record = records.next();
             assertEquals(record.get(0), record.get("A"));
             assertEquals(record.get(1), record.get("B"));
             assertEquals(record.get(2), record.get("C"));
@@ -539,7 +539,7 @@ public class CSVParserTest {
 
     @Test
     public void testGetLineNumberWithLF() throws Exception {
-        CSVParser parser = new CSVParser("a\nb\nc", CSVFormat.DEFAULT.withLineSeparator("\n"));
+        final CSVParser parser = new CSVParser("a\nb\nc", CSVFormat.DEFAULT.withLineSeparator("\n"));
 
         assertEquals(0, parser.getLineNumber());
         assertNotNull(parser.getRecord());
@@ -553,7 +553,7 @@ public class CSVParserTest {
 
     @Test
     public void testGetLineNumberWithCRLF() throws Exception {
-        CSVParser parser = new CSVParser("a\r\nb\r\nc", CSVFormat.DEFAULT.withLineSeparator(CSVFormat.CRLF));
+        final CSVParser parser = new CSVParser("a\r\nb\r\nc", CSVFormat.DEFAULT.withLineSeparator(CSVFormat.CRLF));
 
         assertEquals(0, parser.getLineNumber());
         assertNotNull(parser.getRecord());
@@ -567,7 +567,7 @@ public class CSVParserTest {
 
     @Test
     public void testGetLineNumberWithCR() throws Exception {
-        CSVParser parser = new CSVParser("a\rb\rc", CSVFormat.DEFAULT.withLineSeparator("\r"));
+        final CSVParser parser = new CSVParser("a\rb\rc", CSVFormat.DEFAULT.withLineSeparator("\r"));
 
         assertEquals(0, parser.getLineNumber());
         assertNotNull(parser.getRecord());

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Thu Oct 11 15:47:44 2012
@@ -32,88 +32,88 @@ public class CSVPrinterTest {
 
     @Test
     public void testPrinter1() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
         printer.println("a", "b");
         assertEquals("a,b" + lineSeparator, sw.toString());
     }
 
     @Test
     public void testPrinter2() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
         printer.println("a,b", "b");
         assertEquals("\"a,b\",b" + lineSeparator, sw.toString());
     }
 
     @Test
     public void testPrinter3() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
         printer.println("a, b", "b ");
         assertEquals("\"a, b\",\"b \"" + lineSeparator, sw.toString());
     }
 
     @Test
     public void testPrinter4() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
         printer.println("a", "b\"c");
         assertEquals("a,\"b\"\"c\"" + lineSeparator, sw.toString());
     }
 
     @Test
     public void testPrinter5() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
         printer.println("a", "b\nc");
         assertEquals("a,\"b\nc\"" + lineSeparator, sw.toString());
     }
 
     @Test
     public void testPrinter6() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
         printer.println("a", "b\r\nc");
         assertEquals("a,\"b\r\nc\"" + lineSeparator, sw.toString());
     }
 
     @Test
     public void testPrinter7() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
         printer.println("a", "b\\c");
         assertEquals("a,b\\c" + lineSeparator, sw.toString());
     }
 
     @Test
     public void testExcelPrinter1() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);
         printer.println("a", "b");
         assertEquals("a,b" + lineSeparator, sw.toString());
     }
 
     @Test
     public void testExcelPrinter2() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);
         printer.println("a,b", "b");
         assertEquals("\"a,b\",b" + lineSeparator, sw.toString());
     }
 
     @Test
     public void testPrintNullValues() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
         printer.println("a", null, "b");
         assertEquals("a,,b" + lineSeparator, sw.toString());
     }
 
     @Test
     public void testDisabledComment() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
         printer.printComment("This is a comment");
 
         assertEquals("", sw.toString());
@@ -121,8 +121,8 @@ public class CSVPrinterTest {
 
     @Test
     public void testSingleLineComment() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withCommentStart('#'));
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withCommentStart('#'));
         printer.printComment("This is a comment");
 
         assertEquals("# This is a comment" + lineSeparator, sw.toString());
@@ -130,8 +130,8 @@ public class CSVPrinterTest {
 
     @Test
     public void testMultiLineComment() throws IOException {
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withCommentStart('#'));
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT.withCommentStart('#'));
         printer.printComment("This is a comment\non multiple lines");
 
         assertEquals("# This is a comment" + lineSeparator + "# on multiple lines" + lineSeparator, sw.toString());
@@ -139,35 +139,35 @@ public class CSVPrinterTest {
 
     @Test
     public void testRandom() throws Exception {
-        int iter = 10000;
+        final int iter = 10000;
         doRandom(CSVFormat.DEFAULT, iter);
         doRandom(CSVFormat.EXCEL, iter);
         doRandom(CSVFormat.MYSQL, iter);
     }
 
-    public void doRandom(CSVFormat format, int iter) throws Exception {
+    public void doRandom(final CSVFormat format, final int iter) throws Exception {
         for (int i = 0; i < iter; i++) {
             doOneRandom(format);
         }
     }
 
-    public void doOneRandom(CSVFormat format) throws Exception {
-        Random r = new Random();
+    public void doOneRandom(final CSVFormat format) throws Exception {
+        final Random r = new Random();
 
-        int nLines = r.nextInt(4) + 1;
-        int nCol = r.nextInt(3) + 1;
+        final int nLines = r.nextInt(4) + 1;
+        final int nCol = r.nextInt(3) + 1;
         // nLines=1;nCol=2;
-        String[][] lines = new String[nLines][];
+        final String[][] lines = new String[nLines][];
         for (int i = 0; i < nLines; i++) {
-            String[] line = new String[nCol];
+            final String[] line = new String[nCol];
             lines[i] = line;
             for (int j = 0; j < nCol; j++) {
                 line[j] = randStr();
             }
         }
 
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, format);
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, format);
 
         for (int i = 0; i < nLines; i++) {
             // for (int j=0; j<lines[i].length; j++) System.out.println("### VALUE=:" + printable(lines[i][j]));
@@ -175,19 +175,19 @@ public class CSVPrinterTest {
         }
 
         printer.flush();
-        String result = sw.toString();
+        final String result = sw.toString();
         // System.out.println("### :" + printable(result));
 
-        CSVParser parser = new CSVParser(result, format);
-        List<CSVRecord> parseResult = parser.getRecords();
+        final CSVParser parser = new CSVParser(result, format);
+        final List<CSVRecord> parseResult = parser.getRecords();
 
         Utils.compare("Printer output :" + printable(result), lines, parseResult);
     }
 
-    public static String printable(String s) {
-        StringBuilder sb = new StringBuilder();
+    public static String printable(final String s) {
+        final StringBuilder sb = new StringBuilder();
         for (int i = 0; i < s.length(); i++) {
-            char ch = s.charAt(i);
+            final char ch = s.charAt(i);
             if (ch <= ' ' || ch >= 128) {
                 sb.append("(").append((int) ch).append(")");
             } else {
@@ -198,15 +198,15 @@ public class CSVPrinterTest {
     }
 
     public String randStr() {
-        Random r = new Random();
+        final Random r = new Random();
 
-        int sz = r.nextInt(20);
+        final int sz = r.nextInt(20);
         // sz = r.nextInt(3);
-        char[] buf = new char[sz];
+        final char[] buf = new char[sz];
         for (int i = 0; i < sz; i++) {
             // stick in special chars with greater frequency
             char ch;
-            int what = r.nextInt(20);
+            final int what = r.nextInt(20);
             switch (what) {
                 case 0:
                     ch = '\r';

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java?rev=1397122&r1=1397121&r2=1397122&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java Thu Oct 11 15:47:44 2012
@@ -29,7 +29,7 @@ public class ExtendedBufferedReaderTest 
 
     @Test
     public void testEmptyInput() throws Exception {
-        ExtendedBufferedReader br = getBufferedReader("");
+        final ExtendedBufferedReader br = getBufferedReader("");
         assertEquals(ExtendedBufferedReader.END_OF_STREAM, br.read());
         assertEquals(ExtendedBufferedReader.END_OF_STREAM, br.lookAhead());
         assertEquals(ExtendedBufferedReader.END_OF_STREAM, br.readAgain());
@@ -39,7 +39,7 @@ public class ExtendedBufferedReaderTest 
 
     @Test
     public void testReadLookahead1() throws Exception {
-        ExtendedBufferedReader br = getBufferedReader("1\n2\r3\n");
+        final ExtendedBufferedReader br = getBufferedReader("1\n2\r3\n");
         assertEquals('1', br.lookAhead());
         assertEquals(ExtendedBufferedReader.UNDEFINED, br.readAgain());
         assertEquals('1', br.read());
@@ -90,10 +90,10 @@ public class ExtendedBufferedReaderTest 
 
     @Test
     public void testReadLookahead2() throws Exception {
-        char[] ref = new char[5];
-        char[] res = new char[5];
+        final char[] ref = new char[5];
+        final char[] res = new char[5];
 
-        ExtendedBufferedReader br = getBufferedReader("abcdefg");
+        final ExtendedBufferedReader br = getBufferedReader("abcdefg");
         ref[0] = 'a';
         ref[1] = 'b';
         ref[2] = 'c';
@@ -157,8 +157,8 @@ public class ExtendedBufferedReaderTest 
      */
     @Test
     public void testReadChar() throws Exception {
-        String LF="\n"; String CR="\r"; String CRLF=CR+LF; String LFCR=LF+CR;// easier to read the string below
-        String test="a" + LF + "b" + CR + "c" + LF + LF + "d" + CR + CR + "e" + LFCR + "f "+ CRLF;
+        final String LF="\n"; final String CR="\r"; final String CRLF=CR+LF; final String LFCR=LF+CR;// easier to read the string below
+        final String test="a" + LF + "b" + CR + "c" + LF + LF + "d" + CR + CR + "e" + LFCR + "f "+ CRLF;
         //                EOL        eol        EOL  EOL        eol  eol        EOL+CR        EOL
         final int EOLeolct=9;
         ExtendedBufferedReader br;
@@ -175,12 +175,12 @@ public class ExtendedBufferedReaderTest 
 
         br = getBufferedReader(test);
         assertEquals(0, br.getLineNumber());
-        char[] buff = new char[10];
+        final char[] buff = new char[10];
         while(br.read(buff ,0, 3)!=-1) {}
         assertEquals(EOLeolct, br.getLineNumber());
     }
 
-    private ExtendedBufferedReader getBufferedReader(String s) {
+    private ExtendedBufferedReader getBufferedReader(final String s) {
         return new ExtendedBufferedReader(new StringReader(s));
     }
 }



Mime
View raw message