You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2014/06/16 20:07:46 UTC
svn commit: r1602944 - in /commons/proper/csv/trunk/src:
main/java/org/apache/commons/csv/ test/java/org/apache/commons/csv/
Author: ggregory
Date: Mon Jun 16 18:07:45 2014
New Revision: 1602944
URL: http://svn.apache.org/r1602944
Log:
Use final.
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/CSVParser.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/CSVRecordTest.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=1602944&r1=1602943&r2=1602944&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 Mon Jun 16 18:07:45 2014
@@ -317,8 +317,8 @@ public final class CSVFormat implements
if (header == null) {
this.header = null;
} else {
- Set<String> dupCheck = new HashSet<String>();
- for (String hdr : header) {
+ final Set<String> dupCheck = new HashSet<String>();
+ for (final String hdr : header) {
if (!dupCheck.add(hdr)) {
throw new IllegalArgumentException("The header contains a duplicate entry: '" + hdr + "' in " +
Arrays.toString(header));
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=1602944&r1=1602943&r2=1602944&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 Mon Jun 16 18:07:45 2014
@@ -153,7 +153,7 @@ public final class CSVParser implements
* @throws IOException
* If an I/O error occurs
*/
- public static CSVParser parse(final File file, Charset charset, final CSVFormat format) throws IOException {
+ public static CSVParser parse(final File file, final Charset charset, final CSVFormat format) throws IOException {
Assertions.notNull(file, "file");
Assertions.notNull(format, "format");
// Use the default Charset explicitly
@@ -343,7 +343,7 @@ public final class CSVParser implements
* @throws IOException
* on parse error or input read-failure
*/
- public <T extends Collection<CSVRecord>> T getRecords(T records) throws IOException {
+ public <T extends Collection<CSVRecord>> T getRecords(final T records) throws IOException {
CSVRecord rec;
while ((rec = this.nextRecord()) != null) {
records.add(rec);
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=1602944&r1=1602943&r2=1602944&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 Mon Jun 16 18:07:45 2014
@@ -191,10 +191,10 @@ public class CSVParserTest {
@Test
@Ignore("CSV-107")
public void testBOM() throws IOException {
- URL url = ClassLoader.getSystemClassLoader().getResource("CSVFileParser/bom.csv");
+ final URL url = ClassLoader.getSystemClassLoader().getResource("CSVFileParser/bom.csv");
final CSVParser parser = CSVParser.parse(url, null, CSVFormat.EXCEL.withHeader());
try {
- for (CSVRecord record : parser) {
+ for (final CSVRecord record : parser) {
final String string = record.get("Date");
Assert.assertNotNull(string);
//System.out.println("date: " + record.get("Date"));
@@ -206,11 +206,11 @@ public class CSVParserTest {
@Test
public void testBOMInputStream() throws IOException {
- URL url = ClassLoader.getSystemClassLoader().getResource("CSVFileParser/bom.csv");
- Reader reader = new InputStreamReader(new BOMInputStream(url.openStream()), "UTF-8");
+ final URL url = ClassLoader.getSystemClassLoader().getResource("CSVFileParser/bom.csv");
+ final Reader reader = new InputStreamReader(new BOMInputStream(url.openStream()), "UTF-8");
final CSVParser parser = new CSVParser(reader, CSVFormat.EXCEL.withHeader());
try {
- for (CSVRecord record : parser) {
+ for (final CSVRecord record : parser) {
final String string = record.get("Date");
Assert.assertNotNull(string);
//System.out.println("date: " + record.get("Date"));
@@ -546,8 +546,8 @@ public class CSVParserTest {
*/
@Test
public void testGetOneLineOneParser() throws IOException {
- PipedWriter writer = new PipedWriter();
- PipedReader reader = new PipedReader(writer);
+ final PipedWriter writer = new PipedWriter();
+ final PipedReader reader = new PipedReader(writer);
final CSVFormat format = CSVFormat.DEFAULT;
final CSVParser parser = new CSVParser(reader, format);
try {
Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java?rev=1602944&r1=1602943&r2=1602944&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java Mon Jun 16 18:07:45 2014
@@ -172,7 +172,7 @@ public class CSVRecordTest {
public void testToMapWithNoHeader() throws Exception {
final CSVParser parser = CSVParser.parse("a,b", CSVFormat.newFormat(','));
final CSVRecord shortRec = parser.iterator().next();
- Map<String, String> map = shortRec.toMap();
+ final Map<String, String> map = shortRec.toMap();
assertNotNull("Map is not null.", map);
assertTrue("Map is empty.", map.isEmpty());
}