Skip to content

WW-4428 Add java.time support to JSON plugin (6.8.x backport)#1616

Draft
lukaszlenart wants to merge 1 commit intorelease/struts-6-8-xfrom
WW-4428-json-java-time-support
Draft

WW-4428 Add java.time support to JSON plugin (6.8.x backport)#1616
lukaszlenart wants to merge 1 commit intorelease/struts-6-8-xfrom
WW-4428-json-java-time-support

Conversation

@lukaszlenart
Copy link
Member

Summary

Backport of #1603 to the 6.8.x branch.

  • Add serialization/deserialization support for 6 java.time types (LocalDate, LocalDateTime, LocalTime, ZonedDateTime, OffsetDateTime, Instant) using ISO-8601 defaults
  • Add Calendar deserialization support (was serialize-only)
  • @JSON(format="...") annotation works for per-field custom formats on all new types
  • Existing Date/Calendar serialization behavior unchanged

Fixes WW-4428

Test plan

  • Each java.time type serializes to expected ISO format
  • Each java.time type deserializes from ISO string
  • @JSON(format="dd/MM/yyyy") custom format works for serialization and deserialization
  • Calendar deserialization works
  • Null value handling for temporal types
  • Round-trip test: serialize → deserialize → assert equality (LocalDate, Instant, ZonedDateTime)
  • Custom format for OffsetDateTime serialization and deserialization
  • Malformed input throws JSONException
  • Existing Date/Calendar tests still pass (regression)

🤖 Generated with Claude Code

…upport

- Add serialization support for LocalDate, LocalDateTime, LocalTime,
  ZonedDateTime, OffsetDateTime, and Instant in DefaultJSONWriter
- Add deserialization support for the same types in JSONPopulator
- Support @JSON(format=...) custom formats for all temporal types
- Add Calendar deserialization support (was serialize-only)
- Add comprehensive tests including custom formats, null handling,
  malformed input, and round-trip serialization/deserialization

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
24 Security Hotspots
42.6% Coverage on New Code (required ≥ 80%)
3.4% Duplication on New Code (required ≤ 3%)
E Reliability Rating on New Code (required ≥ A)
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant