这是indexloc提供的服务,不要输入任何密码
Skip to content

Prevent deserialization of "" as null for Duration, Instant, LocalTime, OffsetTime, and YearMonth in "strict" (non-lenient) mode #138

@kupci

Description

@kupci

For the java.time classes Duration, Instant, LocalTime, OffsetTime and YearMonth, an empty string is mapped to null by the associated deserializer, for example DurationDeserializer, InstantDeserializer, etc. So something like {"date": null} can't be distinguished from {"date": ""}. From the view of a strict API, the latter is an error.

It would be good to add some feature to treat empty string as invalid format, so that the associated deserializer (DurationDeserializer, etc) could report this as an error instead of mapping to null. This capability should be noted in the documentation.

This issue is related to issue #114 which was fixed for LocalDate and LocalDateTime. However, the fix is still required for the java.time types listed here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    activeIssue being actively investigated and/or worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions