Repository navigation
Was the Assert.notNull check in RecordFieldSetMapper (mapFieldSet) intentionally added for types where null is a valid value? #5387
Unanswered
ahmad-abed-alhamid
asked this question in
Q&A
Replies: 1 comment
|
Yeah, your understanding was correct — this was a regression, not an intentional restriction on nullable reference types. It was later tracked as #5392 and fixed by #5393. The fix was included in the Spring Batch 6.0.4 milestone. The Primitive components still cannot receive So upgrading from 6.0.3 to 6.0.4 or later should resolve this without needing a custom mapper or workaround. Nice catch and great minimal reproduction! :) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
After migrating to Spring Batch 6.0.3, we noticed that
RecordFieldSetMapperno longer acceptsnullvalues for types where null is a valid value (Long,Integer, etc.).When reading a CSV where a field is empty/blank, e.g.
" ", theSimpleTypeConvertercorrectly converts it tonullforLong. But theAssert.notNulladded in commit62c4cbfrejects this value, causing anIllegalArgumentException.In Spring Batch 5,
nullwas accepted for these types and this worked correctly.Was this change intentional? For primitive types, rejecting
nullmakes sense, but for types where null is a valid value, this causes valid data to be rejected. Should I create an issue for this with a proper example?Thanks!
All reactions