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

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

                Author: ASF GitHub Bot
            Created on: 24/Oct/26 15:07
            Start Date: 24/Oct/26 15:07
    Worklog Time Spent: 10m 
      Work Description: sonarqubecloud[bot] commented on PR #2057:
URL: https://github.com/apache/struts/pull/2057#issuecomment-6385807141

   ## [![Quality Gate 
Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png
 'Quality Gate 
Passed')](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=2057) 
**Quality Gate passed**  
   Issues  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 New 
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=2057&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png
 '') [0 Accepted 
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=2057&issueStatuses=ACCEPTED)
   
   Measures  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=2057&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [100.0% Coverage on New 
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=2057&metric=new_coverage&view=list)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Duplication on New 
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=2057&metric=new_duplicated_lines_density&view=list)
  
     
   <!

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

    Worklog Id:     (was: 1049929)
    Time Spent: 20m  (was: 10m)

> DateConverter rejects valid ISO yyyy-MM-dd dates when a lenient-only format 
> matches first
> -----------------------------------------------------------------------------------------
>
>                 Key: WW-5812
>                 URL: https://issues.apache.org/jira/browse/WW-5812
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>            Reporter: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.5.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> h2. Problem
> {{input type="date"}} always submits {{yyyy-MM-dd}}. When {{DateConverter}} 
> converts that value to {{java.util.Date}}, it rejects it under some locales 
> and global patterns with {{TypeConversionException: Could not parse date}}, 
> even though ISO {{yyyy-MM-dd}} is one of the formats it supports.
> ||Locale||{{"2026-10-24"}} → {{java.util.Date}}||
> |{{nl-NL}}|{{TypeConversionException: Could not parse date}}|
> |{{en-US}}, {{pl-PL}}|2026-10-24 (correct)|
> The format-selection loop picks the *first format that parses leniently*. It 
> then re-parses the input *strictly* with that one format and throws when the 
> strict parse fails. It never tries the remaining formats. Under {{nl-NL}} the 
> locale SHORT pattern {{dd-MM-y}} leniently accepts {{2026-10-24}} (as 18 Apr 
> 2030), so it is selected; the strict re-parse then fails, and the ISO format 
> later in the list is never tried. A global {{struts.date.format}} with {{-}} 
> separators, such as {{dd-MM-yyyy}}, fails the same way.
> The {{java.sql.Timestamp}} branch uses the same lenient-select / 
> strict-re-parse structure. The {{java.time}} branch is not affected: 
> {{DateTimeFormatter}} rejects the ISO string under these patterns, so ISO is 
> reached.
> An earlier version of this ticket said the value was silently misparsed. 
> Probing the real converter showed the result is a conversion error instead.
> This affects {{textfield type="date"}} bound to a {{java.util.Date}} 
> property, and {{datetextfield}} in the html5 theme (WW-5778).
> h2. Proposal
> Select the format *strictly* in the {{java.util.Date}} and 
> {{java.sql.Timestamp}} branches, so a format that only matches leniently is 
> skipped and the remaining formats are tried.
> * Format order is unchanged, so a configured global format still takes 
> precedence
> * Any input that converts today converts to the same value: a strict match is 
> always a lenient match, so the first strict match is the format selected today
> * Inputs that currently throw because a lenient-only format was selected will 
> now convert
> Tests: {{nl-NL}} locale and a {{dd-MM-yyyy}} global format for 
> {{java.util.Date}}, the {{Timestamp}} branch, and existing inputs unchanged.
> Related: WW-5778



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

Reply via email to