Michael Ernst created CSV-246:
---------------------------------

             Summary: Misplaced null test
                 Key: CSV-246
                 URL: https://issues.apache.org/jira/browse/CSV-246
             Project: Commons CSV
          Issue Type: Bug
          Components: Parser
    Affects Versions: 1.7
            Reporter: Michael Ernst


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



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to