-
-
Notifications
You must be signed in to change notification settings - Fork 151
Closed
Description
CsvParser.Feature.EMPTY_STRING_AS_NULL
not works when csv is parsed String[]
.
On the other hand, the feature is valid when csv is parsed as Object[]
.
String csv = "Grace,,Hopper";
CsvMapper csvMapper = CsvMapper.builder()
.enable(CsvParser.Feature.EMPTY_STRING_AS_NULL)
.enable(CsvParser.Feature.WRAP_AS_ARRAY)
.build();
MappingIterator<Object[]> it1 = csvMapper.readerFor(Object[].class).readValues(csv);
it1.hasNext();
Object[] array1= it1.next();
MappingIterator<String[]> it2 = csvMapper.readerFor(String[].class).readValues(csv);
it2.hasNext();
String[] array2= it2.next();
System.out.println(Arrays.toString(array1)); // [Grace, null, Hopper]
System.out.println(Arrays.toString(array2)); // [Grace, , Hopper] array2[1] is not null, but empty string ""
This is strange behavior and both case should parsed as null
, I think.
Is this a bug?
jackson v.2.11.2