Lukasz Lenart created WW-5819:
---------------------------------

             Summary: Log a validator param that fails type conversion instead 
of ignoring it silently
                 Key: WW-5819
                 URL: https://issues.apache.org/jira/browse/WW-5819
             Project: Struts 2
          Issue Type: Improvement
          Components: XML Validators
            Reporter: Lukasz Lenart
             Fix For: 7.5.0


h2. Problem

{{DefaultValidatorFactory}} builds each validator through 
{{ObjectFactory.buildValidator}}, which sets the configured params with type 
conversion errors swallowed. A param that cannot be converted is left unset, 
and nothing is logged. For a range bound, that turns the check off without any 
trace:

{code:xml}<field-validator type="localdate">
    <param name="min">01/02/2026</param>  <!-- not an ISO date: min stays null 
-->
</field-validator>
{code}

h2. Proposal

Keep the current behaviour (the validator is still built and the param is still 
left unset), but log the swallowed conversion error. The message names the 
validator type, the param, the value and the cause:
* WARN by default
* ERROR in devMode

h2. Scope

A logging-only change with no behaviour change, so it is safe for 7.5.0. 
Failing the configuration instead is WW-5818 (8.0.0).

h2. Tests
* an unconvertible param on an XML-configured validator produces the log entry 
at the expected level, and the validator is still built
* a valid param produces no entry



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

Reply via email to