[ 
https://issues.apache.org/jira/browse/WW-5813?focusedWorklogId=1049995&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1049995
 ]

ASF GitHub Bot logged work on WW-5813:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Oct/26 06:17
            Start Date: 25/Oct/26 06:17
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart merged PR #2058:
URL: https://github.com/apache/struts/pull/2058




Issue Time Tracking
-------------------

    Worklog Id:     (was: 1049995)
    Time Spent: 0.5h  (was: 20m)

> DateConverter silently drops the time when the date-time separator does not 
> match the locale pattern
> ----------------------------------------------------------------------------------------------------
>
>                 Key: WW-5813
>                 URL: https://issues.apache.org/jira/browse/WW-5813
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.5.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> When a {{java.util.Date}} (or {{java.sql.Timestamp}}) property receives a 
> date-time whose separator between date and time differs from the locale's 
> date-time pattern, {{DateConverter}} converts it to midnight of that date 
> instead of rejecting it.
> h2. Example
> On JDK 25 the {{nl-NL}} SHORT/MEDIUM date-time pattern is {{dd-MM-y, 
> HH:mm:ss}} (JDK 17/21: {{dd-MM-y HH:mm:ss}}, the comma came with newer CLDR 
> data). Submitting
> {code}24-10-2026 10:15:30
> {code}
> to a {{Date}} property under {{nl-NL}} on JDK 25 yields {{2026-10-24 
> 00:00:00}}. The time is lost without any conversion error. An invalid time is 
> accepted the same way: {{24-10-2026 25:00:00}} also becomes midnight.
> h2. Cause
> No date-time format matches the whole input, so the converter falls back to a 
> date-only format ({{dd-MM-y}}). {{SimpleDateFormat.parse(String)}} stops at 
> the end of the date and ignores the trailing text, so the strict re-parse 
> succeeds on the prefix.
> This exists on {{main}} before WW-5812; WW-5812 only changed which format is 
> selected when one matches the whole input.
> h2. Possible fix
> Require the final parse to consume the whole input (a {{ParsePosition}} 
> check, as WW-5812's format selection already does), and throw 
> {{TypeConversionException}} otherwise.
> This is a behaviour change: any input with trailing text after a valid date, 
> which converts today, would then be rejected. It should be called out in the 
> release notes.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to