Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

Commit c1049b5

Browse files
committed
Use final.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1602944 13f79535-47bb-0310-9956-ffa450edef68
1 parent 2076464 commit c1049b5

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/main/java/org/apache/commons/csv/CSVFormat.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ private CSVFormat(final char delimiter, final Character quoteChar,
317317
if (header == null) {
318318
this.header = null;
319319
} else {
320-
Set<String> dupCheck = new HashSet<String>();
321-
for (String hdr : header) {
320+
final Set<String> dupCheck = new HashSet<String>();
321+
for (final String hdr : header) {
322322
if (!dupCheck.add(hdr)) {
323323
throw new IllegalArgumentException("The header contains a duplicate entry: '" + hdr + "' in " +
324324
Arrays.toString(header));

src/main/java/org/apache/commons/csv/CSVParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
153153
* @throws IOException
154154
* If an I/O error occurs
155155
*/
156-
public static CSVParser parse(final File file, Charset charset, final CSVFormat format) throws IOException {
156+
public static CSVParser parse(final File file, final Charset charset, final CSVFormat format) throws IOException {
157157
Assertions.notNull(file, "file");
158158
Assertions.notNull(format, "format");
159159
// Use the default Charset explicitly
@@ -343,7 +343,7 @@ public List<CSVRecord> getRecords() throws IOException {
343343
* @throws IOException
344344
* on parse error or input read-failure
345345
*/
346-
public <T extends Collection<CSVRecord>> T getRecords(T records) throws IOException {
346+
public <T extends Collection<CSVRecord>> T getRecords(final T records) throws IOException {
347347
CSVRecord rec;
348348
while ((rec = this.nextRecord()) != null) {
349349
records.add(rec);

src/test/java/org/apache/commons/csv/CSVParserTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ public void testBackslashEscapingOld() throws IOException {
191191
@Test
192192
@Ignore("CSV-107")
193193
public void testBOM() throws IOException {
194-
URL url = ClassLoader.getSystemClassLoader().getResource("CSVFileParser/bom.csv");
194+
final URL url = ClassLoader.getSystemClassLoader().getResource("CSVFileParser/bom.csv");
195195
final CSVParser parser = CSVParser.parse(url, null, CSVFormat.EXCEL.withHeader());
196196
try {
197-
for (CSVRecord record : parser) {
197+
for (final CSVRecord record : parser) {
198198
final String string = record.get("Date");
199199
Assert.assertNotNull(string);
200200
//System.out.println("date: " + record.get("Date"));
@@ -206,11 +206,11 @@ public void testBOM() throws IOException {
206206

207207
@Test
208208
public void testBOMInputStream() throws IOException {
209-
URL url = ClassLoader.getSystemClassLoader().getResource("CSVFileParser/bom.csv");
210-
Reader reader = new InputStreamReader(new BOMInputStream(url.openStream()), "UTF-8");
209+
final URL url = ClassLoader.getSystemClassLoader().getResource("CSVFileParser/bom.csv");
210+
final Reader reader = new InputStreamReader(new BOMInputStream(url.openStream()), "UTF-8");
211211
final CSVParser parser = new CSVParser(reader, CSVFormat.EXCEL.withHeader());
212212
try {
213-
for (CSVRecord record : parser) {
213+
for (final CSVRecord record : parser) {
214214
final String string = record.get("Date");
215215
Assert.assertNotNull(string);
216216
//System.out.println("date: " + record.get("Date"));
@@ -546,8 +546,8 @@ public void testGetOneLineCustomCollection() throws IOException {
546546
*/
547547
@Test
548548
public void testGetOneLineOneParser() throws IOException {
549-
PipedWriter writer = new PipedWriter();
550-
PipedReader reader = new PipedReader(writer);
549+
final PipedWriter writer = new PipedWriter();
550+
final PipedReader reader = new PipedReader(writer);
551551
final CSVFormat format = CSVFormat.DEFAULT;
552552
final CSVParser parser = new CSVParser(reader, format);
553553
try {

src/test/java/org/apache/commons/csv/CSVRecordTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void testToMapWithShortRecord() throws Exception {
172172
public void testToMapWithNoHeader() throws Exception {
173173
final CSVParser parser = CSVParser.parse("a,b", CSVFormat.newFormat(','));
174174
final CSVRecord shortRec = parser.iterator().next();
175-
Map<String, String> map = shortRec.toMap();
175+
final Map<String, String> map = shortRec.toMap();
176176
assertNotNull("Map is not null.", map);
177177
assertTrue("Map is empty.", map.isEmpty());
178178
}

0 commit comments

Comments
 (0)