Details
-
Bug
-
Status: Open
-
Trivial
-
Resolution: Unresolved
-
1.7
-
None
-
None
Description
This code appears twice in CSVFileParserTest:
final String comment = record.getComment().replace("\n", "
n");
if (comment != null) {
The test never fails and seems misplaced.
If execution gets past replace without a null pointer exception, then the variable `comment` is definitely non-null.
The test should occur before the call to replace, or perhaps is not needed. (If it's not needed, why not? The documentation of getComment() says it is allowed to return null.)
Here are the two occurrences:
https://github.com/apache/commons-csv/blob/master/src/test/java/org/apache/commons/csv/CSVFileParserTest.java#L122
https://github.com/apache/commons-csv/blob/master/src/test/java/org/apache/commons/csv/CSVFileParserTest.java#L166