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

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

                Author: ASF GitHub Bot
            Created on: 25/Oct/26 08:56
            Start Date: 25/Oct/26 08:56
    Worklog Time Spent: 10m 
      Work Description: sonarqubecloud[bot] commented on PR #2060:
URL: https://github.com/apache/struts/pull/2060#issuecomment-6395648395

   ## [![Quality Gate 
Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png
 'Quality Gate 
Failed')](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=2060) 
**Quality Gate failed**  
   Failed conditions  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png
 '') [8.7% Duplication on New 
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=2060&metric=new_duplicated_lines_density&view=list)
 (required ≤ 3%)  
     
   <!

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

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

> Add a range validator for java.time.LocalDate properties
> --------------------------------------------------------
>
>                 Key: WW-5816
>                 URL: https://issues.apache.org/jira/browse/WW-5816
>             Project: Struts 2
>          Issue Type: New Feature
>          Components: Annotations, XML Validators
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.5.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> h2. Problem
> {{DateRangeFieldValidator}} ({{date}}) is a {{RangeValidatorSupport<Date>}}. 
> On a {{java.time.LocalDate}} property it compares the {{LocalDate}} value 
> against a {{java.util.Date}} bound, which throws {{ClassCastException}}, so a 
> {{LocalDate}} field has no working range validation. {{DateConverter}} and 
> the date tags have supported {{LocalDate}} for some time (WW-5016, WW-5530, 
> WW-5810); the validators have not.
> h2. Proposal
> A separate validator, following the one-class-per-type pattern of the 
> existing range validators:
> * {{LocalDateRangeFieldValidator extends RangeValidatorSupport<LocalDate>}}, 
> registered as {{localdate}} in the default validators
> * {{min}} / {{max}} as ISO dates ({{2026-01-01}}), plus {{minExpression}} / 
> {{maxExpression}}
> * annotation {{@LocalDateRangeFieldValidator}}, a {{localDateRangeFields()}} 
> member on {{@Validations}} (with an empty default, so existing code keeps 
> compiling), and processing in {{AnnotationValidationConfigurationBuilder}}
> * {{LocalDate}} only; {{LocalDateTime}} / {{LocalTime}} can follow on demand
> {{DateRangeFieldValidator}} stays unchanged. The removed legacy client-side 
> validation never supported {{date}}, so nothing is needed there.
> Before implementing, check how a string {{min}} / {{max}} param from XML 
> reaches the generic {{setMin(T)}} / {{setMax(T)}} of 
> {{RangeValidatorSupport}}, and that it ends up as a {{LocalDate}}.
> h2. Requirements
> * Tests: XML and annotation configuration, inclusive bounds, null value 
> skipped, expressions
> * Validator reference docs on struts-site
> Related: WW-5811 (HTML5 {{min}}/{{max}} for {{date}} controls), which will 
> map this validator's bounds directly to {{min="yyyy-MM-dd"}}.



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

Reply via email to