-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
Milestone
@scordio
Description
While working on #4864, I realized that the following:
@Test void testMapFieldSetWithEmptyRecord() { // given RecordFieldSetMapper<Empty> mapper = new RecordFieldSetMapper<>(Empty.class); FieldSet fieldSet = new DefaultFieldSet(new String[0], new String[0]); // when Empty empty = mapper.mapFieldSet(fieldSet); // then assertNotNull(empty); } record Empty() {}
fails with:
java.lang.NullPointerException: Cannot read the array length because "this.constructorParameterNames" is null
at org.springframework.batch.item.file.mapping.RecordFieldSetMapper.mapFieldSet(RecordFieldSetMapper.java:70)
at org.springframework.batch.item.file.mapping.RecordFieldSetMapperTests.testMapFieldSetWithEmptyRecord(RecordFieldSetMapperTests.java:78)
Whether such a use case makes sense, I'm not sure.
Should this corner case be fixed, or should the mapper reject records without components?