Skip to content

Commit ad38b2d

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

2 files changed

Lines changed: 25 additions & 25 deletions

File tree

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

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private void doOneRandom(final CSVFormat format) throws Exception {
8989
final CSVParser parser = CSVParser.parse(result, format);
9090
final List<CSVRecord> parseResult = parser.getRecords();
9191

92-
String[][] expected = lines.clone();
92+
final String[][] expected = lines.clone();
9393
for (int i = 0; i < expected.length; i++) {
9494
expected[i] = expectNulls(expected[i], format);
9595
}
@@ -236,66 +236,66 @@ private Connection geH2Connection() throws SQLException, ClassNotFoundException
236236
@Test
237237
@Ignore
238238
public void testJira135All() throws IOException {
239-
CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
240-
StringWriter sw = new StringWriter();
241-
CSVPrinter printer = new CSVPrinter(sw, format);
242-
List<String> list = new LinkedList<String>();
239+
final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
240+
final StringWriter sw = new StringWriter();
241+
final CSVPrinter printer = new CSVPrinter(sw, format);
242+
final List<String> list = new LinkedList<String>();
243243
list.add("\"");
244244
list.add("\n");
245245
list.add("\\");
246246
printer.printRecord(list);
247247
printer.close();
248248
final String expected = "\"\\\"\",\"\\n\",\"\\\"" + format.getRecordSeparator();
249249
assertEquals(expected, sw.toString());
250-
String[] record0 = toFirstRecordValues(expected, format);
250+
final String[] record0 = toFirstRecordValues(expected, format);
251251
assertArrayEquals(expectNulls(list.toArray(), format), record0);
252252
}
253253

254254
@Test
255255
@Ignore
256256
public void testJira135_part3() throws IOException {
257-
CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
258-
StringWriter sw = new StringWriter();
259-
CSVPrinter printer = new CSVPrinter(sw, format);
260-
List<String> list = new LinkedList<String>();
257+
final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
258+
final StringWriter sw = new StringWriter();
259+
final CSVPrinter printer = new CSVPrinter(sw, format);
260+
final List<String> list = new LinkedList<String>();
261261
list.add("\\");
262262
printer.printRecord(list);
263263
printer.close();
264264
final String expected = "\"\\\\\"" + format.getRecordSeparator();
265265
assertEquals(expected, sw.toString());
266-
String[] record0 = toFirstRecordValues(expected, format);
266+
final String[] record0 = toFirstRecordValues(expected, format);
267267
assertArrayEquals(expectNulls(list.toArray(), format), record0);
268268
}
269269

270270
@Test
271271
@Ignore
272272
public void testJira135_part2() throws IOException {
273-
CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
274-
StringWriter sw = new StringWriter();
275-
CSVPrinter printer = new CSVPrinter(sw, format);
276-
List<String> list = new LinkedList<String>();
273+
final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
274+
final StringWriter sw = new StringWriter();
275+
final CSVPrinter printer = new CSVPrinter(sw, format);
276+
final List<String> list = new LinkedList<String>();
277277
list.add("\n");
278278
printer.printRecord(list);
279279
printer.close();
280280
final String expected = "\"\\n\"" + format.getRecordSeparator();
281281
assertEquals(expected, sw.toString());
282-
String[] record0 = toFirstRecordValues(expected, format);
282+
final String[] record0 = toFirstRecordValues(expected, format);
283283
assertArrayEquals(expectNulls(list.toArray(), format), record0);
284284
}
285285

286286
@Test
287287
@Ignore
288288
public void testJira135_part1() throws IOException {
289-
CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
290-
StringWriter sw = new StringWriter();
291-
CSVPrinter printer = new CSVPrinter(sw, format);
292-
List<String> list = new LinkedList<String>();
289+
final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
290+
final StringWriter sw = new StringWriter();
291+
final CSVPrinter printer = new CSVPrinter(sw, format);
292+
final List<String> list = new LinkedList<String>();
293293
list.add("\"");
294294
printer.printRecord(list);
295295
printer.close();
296296
final String expected = "\"\\\"\"" + format.getRecordSeparator();
297297
assertEquals(expected, sw.toString());
298-
String[] record0 = toFirstRecordValues(expected, format);
298+
final String[] record0 = toFirstRecordValues(expected, format);
299299
assertArrayEquals(expectNulls(list.toArray(), format), record0);
300300
}
301301

@@ -493,8 +493,8 @@ public void testMySqlNullOutput() throws IOException {
493493
* Converts an input CSV array into expected output values WRT NULLs. NULL strings are converted to null values
494494
* because the parser will convert these strings to null.
495495
*/
496-
private <T> T[] expectNulls(T[] original, CSVFormat csvFormat) {
497-
T[] fixed = original.clone();
496+
private <T> T[] expectNulls(final T[] original, final CSVFormat csvFormat) {
497+
final T[] fixed = original.clone();
498498
for (int i = 0; i < fixed.length; i++) {
499499
if (ObjectUtils.equals(csvFormat.getNullString(), fixed[i])) {
500500
fixed[i] = null;
@@ -503,7 +503,7 @@ private <T> T[] expectNulls(T[] original, CSVFormat csvFormat) {
503503
return fixed;
504504
}
505505

506-
private String[] toFirstRecordValues(final String expected, CSVFormat format) throws IOException {
506+
private String[] toFirstRecordValues(final String expected, final CSVFormat format) throws IOException {
507507
return CSVParser.parse(expected, format).getRecords().get(0).values();
508508
}
509509

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class JiraCsv167Test {
3030
@Test
3131
public void parse() throws IOException {
3232
final File csvData = new File("src/test/resources/csv-167/sample1.csv");
33-
BufferedReader br = new BufferedReader(new FileReader(csvData));
33+
final BufferedReader br = new BufferedReader(new FileReader(csvData));
3434
String s = null;
3535
int totcomment = 0;
3636
int totrecs = 0;

0 commit comments

Comments
 (0)