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) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
