Skip to content

7.0.7 + Java 25: Fix for WARNING: Use of the three-letter time zone ID ... is deprecated and it will be removed in a future release#15432

Open
codeconsole wants to merge 12 commits intoapache:8.0.xfrom
codeconsole:time-zone-warning-fix
Open

7.0.7 + Java 25: Fix for WARNING: Use of the three-letter time zone ID ... is deprecated and it will be removed in a future release#15432
codeconsole wants to merge 12 commits intoapache:8.0.xfrom
codeconsole:time-zone-warning-fix

Conversation

@codeconsole
Copy link
Copy Markdown
Contributor

@codeconsole codeconsole commented Feb 21, 2026

When using Java 25, all grails applications startup with

> Task :bootRun
WARNING: Use of the three-letter time zone ID "ACT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "AET" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "AGT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "ART" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "AST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "BET" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "BST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "CAT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "CNT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "CST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "CTT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "EAT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "ECT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "EST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "HST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "IET" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "IST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "JST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "MIT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "MST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "NET" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "NST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "PLT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "PNT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "PRT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "PST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "SST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "VST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "BET" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "PST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "ART" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "JST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "VST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "IET" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "CNT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "PLT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "PNT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "EST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "EAT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "ECT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "PRT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "CTT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "SST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "MST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "AST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "NST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "HST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "ACT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "BST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "AET" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "IST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "CST" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "NET" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "AGT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "CAT" is deprecated and it will be removed in a future release
WARNING: Use of the three-letter time zone ID "MIT" is deprecated and it will be removed in a future release
Grails application running at http://localhost:8090 in environment: development

This is due to the legacy FastDateFormat. This PR switches to java.time instead while maintaining backward compatibility.
The messages no longer occur after this fix.

Marshaller Type Formatter Output Status
json/DateMarshaller Date ISO_INSTANT 2024-06-15T14:30:45.123Z just fixed
json/CalendarMarshaller Calendar ISO_INSTANT 2024-06-15T14:30:45.123Z just fixed
json/InstantMarshaller Instant ISO_INSTANT 2024-06-15T14:30:45.123Z already correct
json/LocalDateMarshaller LocalDate ISO_LOCAL_DATE 2024-06-15 already correct
json/LocalDateTimeMarshaller LocalDateTime ISO_LOCAL_DATE_TIME 2024-06-15T14:30:45.123 already correct
json/OffsetDateTimeMarshaller OffsetDateTime ISO_OFFSET_DATE_TIME 2024-06-15T14:30:45.123+02:00 already correct
json/ZonedDateTimeMarshaller ZonedDateTime ISO_OFFSET_DATE_TIME 2024-06-15T14:30:45.123+02:00 drops zone name
(consider ISO_ZONED_DATE_TIME? compare with Spring 4 default formatting)
json/JavascriptDateMarshaller Date passes Date to JSONWriter (emits JS literal) new Date(1718461845123) unrelated
to ISO/zones
xml/DateMarshaller Date ISO_OFFSET_DATE_TIME (system zone) 2024-06-15T14:30:45.123-04:00 just fixed

…ed and it will be removed in a future release
@jdaugherty
Copy link
Copy Markdown
Contributor

We already merged the fix for this ...

@jdaugherty
Copy link
Copy Markdown
Contributor

I guess this is fixing it by changing to the new api instead of the lang update?

@codeconsole
Copy link
Copy Markdown
Contributor Author

I guess this is fixing it by changing to the new api instead of the lang update?

yeah, but are you sure updating the new api still fixes it?

@codeconsole
Copy link
Copy Markdown
Contributor Author

@jdaugherty if it was already fixed, why am I still getting the error using the latest 7.1.0-SNAPSHOT?

@jdaugherty
Copy link
Copy Markdown
Contributor

#15417 was merged 11hrs ago, I don't think we have merged up to 7.1.x yet

@jdaugherty
Copy link
Copy Markdown
Contributor

I''ve merged these changes up, can you retest before your changes and see if that fixed it? We will still need to take this API to ultimately update the usages, but I assume we'll do that in 7.1.x instead of 7.0.x? @jamesfredley

Copy link
Copy Markdown
Contributor

@jdaugherty jdaugherty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like any tests were added for this change and the default has been changed. This probably should be a 7.1 change.

@bito-code-review
Copy link
Copy Markdown

This question isn’t related to the pull request. I can only help with questions about the PR’s code or comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Java 25 deprecation warnings by migrating from Apache Commons FastDateFormat (which uses deprecated three-letter timezone IDs) to Java's java.time.format.DateTimeFormatter API. The change maintains backward compatibility by preserving support for custom formatters through a legacyFormatter field.

Changes:

  • Replaced FastDateFormat with DateTimeFormatter in date/calendar marshallers
  • Added backward compatibility support for custom formatters via legacyFormatter field
  • Switched from deprecated three-letter timezone IDs to proper timezone handling

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
grails-converters/src/main/groovy/org/grails/web/converters/marshaller/xml/DateMarshaller.java Migrated XML date marshaller to use DateTimeFormatter with system default timezone
grails-converters/src/main/groovy/org/grails/web/converters/marshaller/json/DateMarshaller.java Migrated JSON date marshaller to use DateTimeFormatter with UTC timezone
grails-converters/src/main/groovy/org/grails/web/converters/marshaller/json/CalendarMarshaller.java Migrated JSON calendar marshaller to use DateTimeFormatter with UTC timezone

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jamesfredley
Copy link
Copy Markdown
Contributor

Since this doesn't fix a bug, but resolves annoying log lines when running on Java 25 by changing production code, I think this would be safer in 7.1.x.

Cover default DateTimeFormatter output, millisecond padding, UTC
conversion, legacy Format fallback, and supports() behavior for
json/DateMarshaller, json/CalendarMarshaller, and xml/DateMarshaller.

Assisted-by: Claude Code <Claude@Claude.ai>
@jdaugherty
Copy link
Copy Markdown
Contributor

@jamesfredley shouldn't we add functional / integration tests for this too given the impact? we're only testing the lower level stuff with this pr

Add DateMarshallerController and DateMarshallerSpec integration tests
to grails-test-examples/app1, exercising the DateTimeFormatter-based
marshallers end-to-end through the Grails converters pipeline.

Tests cover:
- JSON Date marshalling (ISO 8601 UTC format)
- JSON Calendar marshalling (ISO 8601 UTC format)
- XML Date marshalling (system default timezone format)
- 3-digit millisecond padding (.SSS) for both JSON and XML
- URL extension-based content negotiation (.json, .xml)

Assisted-by: Claude Code <Claude@Claude.ai>
Copy link
Copy Markdown
Contributor

@matrei matrei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we target 8.0.x?

@codeconsole codeconsole changed the base branch from 7.0.x to 8.0.x April 29, 2026 23:20
@codeconsole
Copy link
Copy Markdown
Contributor Author

Can we target 8.0.x?

@matrei ok

@testlens-app
Copy link
Copy Markdown

testlens-app Bot commented Apr 30, 2026

✅ All tests passed ✅

🏷️ Commit: 0d140fe
▶️ Tests: 15884 executed
⚪️ Checks: 35/35 completed


Learn more about TestLens at testlens.app.

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

6 participants