[
https://issues.apache.org/jira/browse/LANG-1718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17833419#comment-17833419
]
Konrad Windszus commented on LANG-1718:
---------------------------------------
Only Java 23 will provide a backwards compatible solution via
{{{}parseLenient{}}}: https://inside.java/2024/03/29/quality-heads-up/
> FastDateFormat.getTimeInstance(FastDateFormat.SHORT, Locale.US) uses
> incorrect separator on JDK21
> -------------------------------------------------------------------------------------------------
>
> Key: LANG-1718
> URL: https://issues.apache.org/jira/browse/LANG-1718
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.time.*
> Affects Versions: 3.13.0
> Reporter: Konrad Windszus
> Priority: Major
>
> The following code piece fails with a ParseException on JDK 21.0.1 but
> succeeds with JDK 17.0.7 (and earlier)
> {code}
> FastDateFormat dateFormat =
> FastDateFormat.getTimeInstance(FastDateFormat.SHORT, Locale.US);
> dateFormat2.parse("11:00 AM");
> {code}
> The reason for that is that the {{dateFormat.pattern}} with JDK21 is
> {code}
> [104, 0, 58, 0, 109, 0, 109, 0, 47, 32, 97, 0]
> {code}
> while with JDK 17 it is
> {code}
> [104, 58, 109, 109, 32, 97]
> {code}
> Notice the difference in the separator between the time and the am/pm!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)