pedjak/grails-csv — pull request #1 by ricklansky (2011-11-03 20:29:50+00:00)
Title: Handling of null values in the CSVWriter

Hi,

While using the CSVWriter, I noticed that it doesn't seem to be handling the writing of null values correctly. Instead of writing out nulls as empty values as I would expect (and as is done in the OpenCSV project), it writes out the text "null" instead.

I've added a quick fix in the CSVWriter.groovy file that checks for null values when it's writing. And if it has one, it just leaves that value empty. This replicates the behavior seen in OpenCSV.

I've also added a test for this in unit/.../CSVWriterTests.groovy. The test fails when run against the old code and passes when run against the modified code.

Cheers,
--Rick Lansky