42BV / CSVeed

Light-weight, easy-to-use Java-based CSV utility
Apache License 2.0
100 stars 22 forks source link

Annotation @CsvCell(required = false) does not work with empty Number fields #76

Open bertrik opened 8 years ago

bertrik commented 8 years ago

I have a CSV with number fields that are not always filled (converted from an XLS with merged cells). I've annotated this field as follows in the bean: @CsvCell(required = false) private Integer memoryAddress; yet when I try to read the CSV with an empty cell for this field, I get a CsvException saying: "Problem converting cell index 13 (M) [] to memoryAddress: java.lang.Number"

So it seems the "required" property of the @CsvCell annotation does not work for Integers, apparently only for Strings. Instead of the exception I expected this field would just simply be null in the bean and not cause an exception because of the "required=false" annotation.

version info: 'org.csveed:csveed:0.4.2'