Use final.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1602944 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2076464484
commit
c1049b549b
|
@ -317,8 +317,8 @@ public final class CSVFormat implements Serializable {
|
|||
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));
|
||||
|
|
|
@ -153,7 +153,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
|
|||
* @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 Iterable<CSVRecord>, Closeable {
|
|||
* @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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue