[
https://issues.apache.org/jira/browse/OPENJPA-2983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18109504#comment-18109504
]
ASF subversion and git services commented on OPENJPA-2983:
----------------------------------------------------------
Commit 01b4c1e4ec2a4a4a545a1329015903bb2a93b238 in openjpa's branch
refs/heads/OPENJPA-2983 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=01b4c1e4e ]
[OPENJPA-2983] Resolve EXTRACT temporal fields by constant, not by name
CriteriaBuilderImpl.extract() derived the DateTimeExtractField from
field.toString().toUpperCase(), which depends on the default locale and on
the textual representation the specification constants happen to use. Map
the LocalDateField / LocalTimeField / LocalDateTimeField constants to their
DateTimeExtractField equivalents by identity instead, and reject any other
temporal field with a meaningful message instead of letting Enum.valueOf
fail.
TestExtractTemporalField pins every entry of the new mapping table, which
is where the risk now sits: it is a characterisation test of the 16 hand
written pairs, not a reproduction of the original defect, since the name
based lookup produced the same result for all constants once Locale.ROOT
was passed.
> Locale-sensitive toUpperCase on temporal field name
> ---------------------------------------------------
>
> Key: OPENJPA-2983
> URL: https://issues.apache.org/jira/browse/OPENJPA-2983
> Project: OpenJPA
> Issue Type: Sub-task
> Components: jpa
> Affects Versions: 4.2.0
> Reporter: Maxim Solodovnik
> Assignee: Maxim Solodovnik
> Priority: Major
> Fix For: 4.2.0
>
>
> Discussion thread:
> https://github.com/apache/openjpa/pull/144#discussion_r3683005413
> **(low)** `field.toString().toUpperCase()` is locale-sensitive ("minute"
> breaks under a Turkish default locale). Prefer `toUpperCase(Locale.ROOT)`,
> and ideally key off the known LocalDateField/LocalTimeField constants rather
> than `toString()`.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)