Skip to content

Commit e835cb2

Browse files
committed
Remove redundant keywords
1 parent ab37149 commit e835cb2

5 files changed

Lines changed: 29 additions & 31 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private CSVRecord getNextRecord() {
151151

152152
@Override
153153
public boolean hasNext() {
154-
if (CSVParser.this.isClosed()) {
154+
if (isClosed()) {
155155
return false;
156156
}
157157
if (current == null) {
@@ -163,7 +163,7 @@ public boolean hasNext() {
163163

164164
@Override
165165
public CSVRecord next() {
166-
if (CSVParser.this.isClosed()) {
166+
if (isClosed()) {
167167
throw new NoSuchElementException("CSVParser has been closed");
168168
}
169169
CSVRecord next = current;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public CSVPrinter(final Appendable appendable, final CSVFormat format) throws IO
110110
final String[] headerComments = format.getHeaderComments();
111111
if (headerComments != null) {
112112
for (final String line : headerComments) {
113-
this.printComment(line);
113+
printComment(line);
114114
}
115115
}
116116
if (format.getHeader() != null && !format.getSkipHeaderRecord()) {

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

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,11 @@
5454

5555
import org.apache.commons.io.input.BOMInputStream;
5656
import org.apache.commons.io.input.BrokenInputStream;
57-
import org.apache.commons.lang3.stream.Streams.FailableStream;
5857
import org.junit.jupiter.api.Assertions;
5958
import org.junit.jupiter.api.Disabled;
6059
import org.junit.jupiter.api.Test;
6160
import org.junit.jupiter.params.ParameterizedTest;
6261
import org.junit.jupiter.params.provider.EnumSource;
63-
import org.junit.jupiter.params.provider.ValueSource;
6462

6563
/**
6664
* CSVParserTest
@@ -754,17 +752,17 @@ public void testGetLine() throws IOException {
754752

755753
@Test
756754
public void testGetLineNumberWithCR() throws Exception {
757-
this.validateLineNumbers(String.valueOf(CR));
755+
validateLineNumbers(String.valueOf(CR));
758756
}
759757

760758
@Test
761759
public void testGetLineNumberWithCRLF() throws Exception {
762-
this.validateLineNumbers(CRLF);
760+
validateLineNumbers(CRLF);
763761
}
764762

765763
@Test
766764
public void testGetLineNumberWithLF() throws Exception {
767-
this.validateLineNumbers(String.valueOf(LF));
765+
validateLineNumbers(String.valueOf(LF));
768766
}
769767

770768
@Test
@@ -797,27 +795,27 @@ public void testGetOneLineOneParser() throws IOException {
797795

798796
@Test
799797
public void testGetRecordNumberWithCR() throws Exception {
800-
this.validateRecordNumbers(String.valueOf(CR));
798+
validateRecordNumbers(String.valueOf(CR));
801799
}
802800

803801
@Test
804802
public void testGetRecordNumberWithCRLF() throws Exception {
805-
this.validateRecordNumbers(CRLF);
803+
validateRecordNumbers(CRLF);
806804
}
807805

808806
@Test
809807
public void testGetRecordNumberWithLF() throws Exception {
810-
this.validateRecordNumbers(String.valueOf(LF));
808+
validateRecordNumbers(String.valueOf(LF));
811809
}
812810

813811
@Test
814812
public void testGetRecordPositionWithCRLF() throws Exception {
815-
this.validateRecordPosition(CRLF);
813+
validateRecordPosition(CRLF);
816814
}
817815

818816
@Test
819817
public void testGetRecordPositionWithLF() throws Exception {
820-
this.validateRecordPosition(String.valueOf(LF));
818+
validateRecordPosition(String.valueOf(LF));
821819
}
822820

823821
@Test
@@ -1329,7 +1327,7 @@ public void testParseWithDelimiterStringWithEscape() throws IOException {
13291327
assertEquals("xyz", csvRecord.get(1));
13301328
}
13311329
}
1332-
1330+
13331331
@Test
13341332
public void testParseWithDelimiterStringWithQuote() throws IOException {
13351333
final String source = "'a[|]b[|]c'[|]xyz\r\nabc[abc][|]xyz";
@@ -1343,7 +1341,7 @@ public void testParseWithDelimiterStringWithQuote() throws IOException {
13431341
assertEquals("xyz", csvRecord.get(1));
13441342
}
13451343
}
1346-
1344+
13471345
@Test
13481346
public void testParseWithDelimiterWithEscape() throws IOException {
13491347
final String source = "a!,b!,c,xyz";
@@ -1354,7 +1352,7 @@ public void testParseWithDelimiterWithEscape() throws IOException {
13541352
assertEquals("xyz", csvRecord.get(1));
13551353
}
13561354
}
1357-
1355+
13581356
@Test
13591357
public void testParseWithDelimiterWithQuote() throws IOException {
13601358
final String source = "'a,b,c',xyz";
@@ -1365,15 +1363,15 @@ public void testParseWithDelimiterWithQuote() throws IOException {
13651363
assertEquals("xyz", csvRecord.get(1));
13661364
}
13671365
}
1368-
1366+
13691367
@Test
13701368
public void testParseWithQuoteThrowsException() {
13711369
final CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'');
13721370
assertThrows(IOException.class, () -> csvFormat.parse(new StringReader("'a,b,c','")).nextRecord());
13731371
assertThrows(IOException.class, () -> csvFormat.parse(new StringReader("'a,b,c'abc,xyz")).nextRecord());
13741372
assertThrows(IOException.class, () -> csvFormat.parse(new StringReader("'abc'a,b,c',xyz")).nextRecord());
13751373
}
1376-
1374+
13771375
@Test
13781376
public void testParseWithQuoteWithEscape() throws IOException {
13791377
final String source = "'a?,b?,c?d',xyz";
@@ -1384,7 +1382,7 @@ public void testParseWithQuoteWithEscape() throws IOException {
13841382
assertEquals("xyz", csvRecord.get(1));
13851383
}
13861384
}
1387-
1385+
13881386
@ParameterizedTest
13891387
@EnumSource(CSVFormat.Predefined.class)
13901388
public void testParsingPrintedEmptyFirstColumn(final CSVFormat.Predefined format) throws Exception {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,10 @@ public void testIterator() {
236236
public void testPutInMap() {
237237
final Map<String, String> map = new ConcurrentHashMap<>();
238238
this.recordWithHeader.putIn(map);
239-
this.validateMap(map, false);
239+
validateMap(map, false);
240240
// Test that we can compile with assignment to the same map as the param.
241241
final TreeMap<String, String> map2 = recordWithHeader.putIn(new TreeMap<>());
242-
this.validateMap(map2, false);
242+
validateMap(map2, false);
243243
}
244244

245245
@Test
@@ -339,7 +339,7 @@ public void testToListSet() {
339339
@Test
340340
public void testToMap() {
341341
final Map<String, String> map = this.recordWithHeader.toMap();
342-
this.validateMap(map, true);
342+
validateMap(map, true);
343343
}
344344

345345
@Test

src/test/java/org/apache/commons/csv/perf/PerformanceTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ private long readAll(final BufferedReader in) throws IOException {
100100

101101
public long testParseBigFile(final boolean traverseColumns) throws Exception {
102102
final long startMillis = System.currentTimeMillis();
103-
try (final BufferedReader reader = this.createBufferedReader()) {
104-
final long count = this.parse(reader, traverseColumns);
103+
try (final BufferedReader reader = createBufferedReader()) {
104+
final long count = parse(reader, traverseColumns);
105105
final long totalMillis = System.currentTimeMillis() - startMillis;
106-
this.println(
106+
println(
107107
String.format("File parsed in %,d milliseconds with Commons CSV: %,d lines.", totalMillis, count));
108108
return totalMillis;
109109
}
@@ -113,9 +113,9 @@ public long testParseBigFile(final boolean traverseColumns) throws Exception {
113113
public void testParseBigFileRepeat() throws Exception {
114114
long bestTime = Long.MAX_VALUE;
115115
for (int i = 0; i < this.max; i++) {
116-
bestTime = Math.min(this.testParseBigFile(false), bestTime);
116+
bestTime = Math.min(testParseBigFile(false), bestTime);
117117
}
118-
this.println(String.format("Best time out of %,d is %,d milliseconds.", this.max, bestTime));
118+
println(String.format("Best time out of %,d is %,d milliseconds.", this.max, bestTime));
119119
}
120120

121121
@Test
@@ -124,14 +124,14 @@ public void testReadBigFile() throws Exception {
124124
long count;
125125
for (int i = 0; i < this.max; i++) {
126126
final long startMillis;
127-
try (final BufferedReader in = this.createBufferedReader()) {
127+
try (final BufferedReader in = createBufferedReader()) {
128128
startMillis = System.currentTimeMillis();
129-
count = this.readAll(in);
129+
count = readAll(in);
130130
}
131131
final long totalMillis = System.currentTimeMillis() - startMillis;
132132
bestTime = Math.min(totalMillis, bestTime);
133-
this.println(String.format("File read in %,d milliseconds: %,d lines.", totalMillis, count));
133+
println(String.format("File read in %,d milliseconds: %,d lines.", totalMillis, count));
134134
}
135-
this.println(String.format("Best time out of %,d is %,d milliseconds.", this.max, bestTime));
135+
println(String.format("Best time out of %,d is %,d milliseconds.", this.max, bestTime));
136136
}
137137
}

0 commit comments

Comments
 (0)