Accept all java.time type values when pattern and type co-exist - #5890
Draft
BalusC wants to merge 1 commit into
Draft
Accept all java.time type values when pattern and type co-exist#5890BalusC wants to merge 1 commit into
BalusC wants to merge 1 commit into
Conversation
ConvertDateTimeHandler only forwarded type to the converter alongside a pattern when the type name started with 'l', 'o' or 'z', which covered localDate/offsetTime/zonedDateTime and friends but silently dropped the instant, year, yearMonth and monthDay types added in faces#2211. The converter then kept its default type "date" and took the legacy SimpleDateFormat path, which fails on a java.time value. Replaced by an explicit set of the type values listed in DateTimeConverter#setType. See jakartaee/faces#2211 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
BalusC
marked this pull request as draft
July 31, 2026 13:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Undraft only when jakartaee/faces#2221 is merged!
Companion to jakartaee/faces#2211 / jakartaee/faces#2221, which add
instant,year,yearMonthandmonthDayto thetypeattribute ofDateTimeConverter.ConvertDateTimeHandler.setAttributesonly forwardstypeto the converter alongside apatternwhenisJavaTimeType(type)holds, and that method tested the first character:That covers
local*,offset*andzoned*, but silently drops the four new type values. The converter then keeps its defaulttype="date"and takes the legacySimpleDateFormatbranch, which cannot handle ajava.timevalue:<f:convertDateTime type="monthDay" pattern="dd-MM" />parses30-07into ajava.util.Dateof 1970-07-30, then fails withIllegalArgumentException: Cannot convert 7/29/70, 8:00 PM of type class java.util.Date to class java.time.MonthDayduring Process Validations.<f:convertDateTime type="instant" pattern="uuuu-MM-dd HH:mm:ss" />fails withIllegalArgumentException: Cannot format given Object as a Dateduring Render Response.Replaced the character check with an explicit set of the values listed in
DateTimeConverter#setType, and inlined the now-trivialisJavaTimeTypeinto its single call site.Covered by
Spec2211ITin jakartaee/faces#2221 (tck/faces50/converters), which fails onmasterand passes with this change. Verified locally:faces50/converters31/31,faces23/datetime-converter11/11,faces20/api/converter-validatorgreen.🤖 Generated with Claude Code (Opus 5)