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

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

                Author: ASF GitHub Bot
            Created on: 23/Jul/26 19:47
            Start Date: 23/Jul/26 19:47
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #1810:
URL: https://github.com/apache/struts/pull/1810

   Fixes [WW-2934](https://issues.apache.org/jira/browse/WW-2934)
   
   ## Problem
   
   When a field fails type conversion (e.g. a user types `one` into an `Integer 
age` field), the user sees **two** errors for the same field:
   
   1. The conversion error, added by `ConversionErrorInterceptor` (which runs 
before validation in the default stack).
   2. A redundant field-validator error (e.g. `required`), because binding 
failed and the field holds its default value.
   
   Once a value could not be converted, the field's remaining validators are 
operating on a value the user never entered, so they should be skipped.
   
   ## Change
   
   Adds an **opt-in** global constant 
`struts.validators.skipValidatorsOnConversionError` (default **`false`** — zero 
behavior change for existing apps).
   
   When enabled, `DefaultActionValidatorManager` skips a field's remaining 
validators once that field has an entry in 
`ActionContext.getConversionErrors()`, with two guarantees:
   
   - The field's own `conversion` validator (`ConversionErrorFieldValidator`) 
still runs, so its (optionally custom) message is preserved.
   - Action-level (non-field) validators are untouched.
   
   The guard sits in the single `validate(...)` choke point that both XML- and 
annotation-driven validation funnel through, and reuses the already-computed 
full field name (so nested/indexed fields match correctly).
   
   ## Tests
   
   `DefaultActionValidatorManagerTest` gains coverage for: flag off → both 
errors (unchanged behavior); flag on → redundant validator skipped, conversion 
message retained; unrelated field still validated; action-level validator 
unaffected; and the same skip firing through the default 
`AnnotationActionValidatorManager`. Full `validator` package suite: 172/172 
green.
   
   ## Note
   
   This branch also includes the design spec and implementation plan under 
`docs/superpowers/`. Happy to drop those commits if you'd prefer a code-only PR.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   




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

            Worklog Id:     (was: 1031931)
    Remaining Estimate: 0h
            Time Spent: 10m

> conversion error should short-circuit all validators 
> -----------------------------------------------------
>
>                 Key: WW-2934
>                 URL: https://issues.apache.org/jira/browse/WW-2934
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Interceptors
>    Affects Versions: 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 
> 2.0.8, 2.0.9, 2.0.10, 2.0.11, 2.0.11.1, 2.0.11.2, 2.0.12, 2.0.13, 2.0.14, 
> 2.1.0, 2.1.1, 2.1.2
>            Reporter: Noel Hernández
>            Priority: Major
>             Fix For: 7.3.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> If there is an error converting a field, the validators for that field should 
> be skipped. For example, let's say I have an action with an "age" field 
> declared as an Integer, and the field is required. If the user enters "one", 
> the user will see two errors: one from the conversion process, and one from 
> the required validator (since the field was never assigned).
> In general, a conversion error should short-circuit all validators for that 
> field, since validators depend on the field being set, which never happens if 
> there was a conversion error.
> Validators are essential for real world projects, this is a big issue with 
> struts2.
> look at stripes framework for a good designed validator framework.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to