Skip to content

Commit 5941149

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

8 files changed

Lines changed: 20 additions & 20 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private Assertions() {
2828
// can not be instantiated
2929
}
3030

31-
public static void notNull(Object parameter, String parameterName) {
31+
public static void notNull(final Object parameter, final String parameterName) {
3232
if (parameter == null) {
3333
throw new IllegalArgumentException("Parameter '" + parameterName + "' must not be null!");
3434
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public static CSVFormat newFormat(final char delimiter) {
293293
final Quote quotePolicy, final Character commentStart,
294294
final Character escape, final boolean ignoreSurroundingSpaces,
295295
final boolean ignoreEmptyLines, final String recordSeparator,
296-
final String nullString, final String[] header, boolean skipHeaderRecord) {
296+
final String nullString, final String[] header, final boolean skipHeaderRecord) {
297297
if (isLineBreak(delimiter)) {
298298
throw new IllegalArgumentException("The delimiter cannot be a line break");
299299
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
145145
* @throws IOException
146146
* If an I/O error occurs
147147
*/
148-
public static CSVParser parse(File file, final CSVFormat format) throws IOException {
148+
public static CSVParser parse(final File file, final CSVFormat format) throws IOException {
149149
Assertions.notNull(file, "file");
150150
Assertions.notNull(format, "format");
151151

@@ -165,7 +165,7 @@ public static CSVParser parse(File file, final CSVFormat format) throws IOExcept
165165
* @throws IOException
166166
* If an I/O error occurs
167167
*/
168-
public static CSVParser parse(String string, final CSVFormat format) throws IOException {
168+
public static CSVParser parse(final String string, final CSVFormat format) throws IOException {
169169
Assertions.notNull(string, "string");
170170
Assertions.notNull(format, "format");
171171

@@ -192,7 +192,7 @@ public static CSVParser parse(String string, final CSVFormat format) throws IOEx
192192
* @throws IOException
193193
* If an I/O error occurs
194194
*/
195-
public static CSVParser parse(URL url, Charset charset, final CSVFormat format) throws IOException {
195+
public static CSVParser parse(final URL url, final Charset charset, final CSVFormat format) throws IOException {
196196
Assertions.notNull(url, "url");
197197
Assertions.notNull(charset, "charset");
198198
Assertions.notNull(format, "format");

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public final class CSVRecord implements Serializable, Iterable<String> {
6262
* an enum
6363
* @return the String at the given enum String
6464
*/
65-
public String get(Enum<?> e) {
65+
public String get(final Enum<?> e) {
6666
return get(e.toString());
6767
}
6868

@@ -175,8 +175,8 @@ public Iterator<String> iterator() {
175175
* @param map The Map to populate.
176176
* @return the given map.
177177
*/
178-
public Map<String, String> putIn(Map<String, String> map) {
179-
for (Entry<String, Integer> entry : mapping.entrySet()) {
178+
public Map<String, String> putIn(final Map<String, String> map) {
179+
for (final Entry<String, Integer> entry : mapping.entrySet()) {
180180
map.put(entry.getKey(), values[entry.getValue().intValue()]);
181181
}
182182
return map;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public void testCSVUrl() throws Exception {
154154
assertEquals(testName + " Expected format ", line, format.toString());
155155

156156
// Now parse the file and compare against the expected results
157-
URL resource = ClassLoader.getSystemResource("CSVFileParser/" + split[0]);
157+
final URL resource = ClassLoader.getSystemResource("CSVFileParser/" + split[0]);
158158
final CSVParser parser = CSVParser.parse(resource, Charset.forName("UTF-8"), format);
159159
for (final CSVRecord record : parser) {
160160
String parsed = record.toString();

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -493,17 +493,17 @@ public void testIterator() throws Exception {
493493

494494
@Test // TODO this may lead to strange behavior, throw an exception if iterator() has already been called?
495495
public void testMultipleIterators() throws Exception {
496-
CSVParser parser = CSVParser.parse("a,b,c" + CR + "d,e,f", CSVFormat.DEFAULT);
496+
final CSVParser parser = CSVParser.parse("a,b,c" + CR + "d,e,f", CSVFormat.DEFAULT);
497497

498-
Iterator<CSVRecord> itr1 = parser.iterator();
499-
Iterator<CSVRecord> itr2 = parser.iterator();
498+
final Iterator<CSVRecord> itr1 = parser.iterator();
499+
final Iterator<CSVRecord> itr2 = parser.iterator();
500500

501-
CSVRecord first = itr1.next();
501+
final CSVRecord first = itr1.next();
502502
assertEquals("a", first.get(0));
503503
assertEquals("b", first.get(1));
504504
assertEquals("c", first.get(2));
505505

506-
CSVRecord second = itr2.next();
506+
final CSVRecord second = itr2.next();
507507
assertEquals("d", second.get(0));
508508
assertEquals("e", second.get(1));
509509
assertEquals("f", second.get(2));

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,26 +118,26 @@ public void testIsSet() {
118118
@Test
119119
public void testIterator() {
120120
int i = 0;
121-
for (String value : record) {
121+
for (final String value : record) {
122122
assertEquals(values[i], value);
123123
i++;
124124
}
125125
}
126126

127127
@Test
128128
public void testPutInMap() {
129-
Map<String, String> map = new ConcurrentHashMap<String, String>();
129+
final Map<String, String> map = new ConcurrentHashMap<String, String>();
130130
this.recordWithHeader.putIn(map);
131131
this.validateMap(map, false);
132132
}
133133

134134
@Test
135135
public void testToMap() {
136-
Map<String, String> map = this.recordWithHeader.toMap();
136+
final Map<String, String> map = this.recordWithHeader.toMap();
137137
this.validateMap(map, true);
138138
}
139139

140-
private void validateMap(Map<String, String> map, boolean allowsNulls) {
140+
private void validateMap(final Map<String, String> map, final boolean allowsNulls) {
141141
assertTrue(map.containsKey("first"));
142142
assertTrue(map.containsKey("second"));
143143
assertTrue(map.containsKey("third"));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private enum ContractColumnNames {
4343

4444
@Test
4545
public void testContractFile() throws IOException {
46-
URL contractData = ClassLoader.getSystemClassLoader().getResource("ferc.gov/contract.txt");
46+
final URL contractData = ClassLoader.getSystemClassLoader().getResource("ferc.gov/contract.txt");
4747
final CSVParser parser = CSVParser.parse(contractData, US_ASCII,
4848
CSVFormat.DEFAULT.withHeader());
4949
try {
@@ -67,7 +67,7 @@ record = records.get(records.size() - 1);
6767

6868
@Test
6969
public void testTransactionFile() throws IOException {
70-
URL transactionData = ClassLoader.getSystemClassLoader().getResource("ferc.gov/transaction.txt");
70+
final URL transactionData = ClassLoader.getSystemClassLoader().getResource("ferc.gov/transaction.txt");
7171
final CSVParser parser = CSVParser.parse(transactionData, US_ASCII,
7272
CSVFormat.DEFAULT.withHeader());
7373
try {

0 commit comments

Comments
 (0)