-
Notifications
You must be signed in to change notification settings - Fork 122
Prevent deserialization of "" as null
for Duration
, Instant
, LocalTime
, OffsetTime
, Period
, ZoneDateTime
, ZoneId
, ZoneOffset
and YearMonth
in "strict" (non-lenient)
#144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…lso added tests for empty string handling for Duration, Instant and ZonedDateTime deserializers.
This is ready for review, though still need to add fix to |
null
for Duration
, Instant
, LocalTime
, OffsetTime
, and YearMonth
in "strict" (non-lenient) null
for Duration
, Instant
, LocalTime
, OffsetTime
, Period
, ZoneDateTime
, ZoneId
, ZoneOffset
and YearMonth
in "strict" (non-lenient)
import java.time.ZoneId; | ||
import java.time.ZoneOffset; | ||
import java.time.ZonedDateTime; | ||
import java.time.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IntelliJ is helpfully removing all the imports and starring them, I'll need to find that setting and fix this...
import java.time.OffsetDateTime; | ||
import java.time.ZoneId; | ||
import java.time.ZoneOffset; | ||
import java.time.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix imports
import com.fasterxml.jackson.datatype.jsr310.MockObjectConfiguration; | ||
import com.fasterxml.jackson.datatype.jsr310.ModuleTestBase; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style...
LGTM (quick glance, but based on previous work, scope, I don't see high risk). Makes sense for 2.11 in particular, will merge. |
For the java.time classes Duration, Instant, LocalTime, OffsetDateTime, OffsetTime, Period, ZoneDateTime, ZoneId, ZoneOffset and YearMonth, this fix prevents an empty string from being mapped to null where the "strict" (non-lenient) configuration is set.
See issue #138