lukaszlenart opened a new pull request, #1814: URL: https://github.com/apache/struts/pull/1814
Fixes [WW-3427](https://issues.apache.org/jira/browse/WW-3427) ## What Adds a regression test proving that a conversion error thrown while binding an **aliased** property (via `AliasInterceptor`) is reported, exactly as it would be for a non-aliased property. The original report (against 2.1.8.1) was that when an aliased property's custom `TypeConverter` throws `TypeConversionException`, the error is never caught by `ConversionErrorInterceptor` / `ConversionErrorFieldValidator`. ## Why this is test-only The defect is already fixed in current code. `AliasInterceptor` binds the alias on a secure child stack with `setReportingConversionErrors(context, true)` and then copies the resulting conversion errors back into the original `ActionContext`: ```java if (clearableStack) { stack.getActionContext().withConversionErrors(newStack.getActionContext().getConversionErrors()); } ``` `XWorkConverter.handleConversionException` records the `TypeConversionException` into that context, so `ConversionErrorInterceptor` picks it up downstream. This path was simply never covered by a test, and the ticket was never verified/closed. ## The test `AliasInterceptorTest#testConversionErrorOnAliasedPropertyIsReported` drives an action through `params -> alias -> conversionError` with an aliased `BigDecimal` property bound through a converter that always throws, and asserts the failure surfaces both in `ActionContext.getConversionErrors()` and as a field error on the aliased property. It genuinely guards the behavior: removing the copy-back in `AliasInterceptor` makes the test fail with `"conversion error for aliased property was swallowed"`, reproducing the original WW-3427 symptom. ## Files - `AliasInterceptorTest.java` — new test method - `AliasConversionAction.java` — action with an aliased `BigDecimal aliasDest` - `ThrowingTypeConverter.java` — converter that always throws `TypeConversionException` - `AliasConversionAction-conversion.properties` — registers the converter for `aliasDest` - `xwork-alias-conversion.xml` — dedicated config (`params -> alias -> conversionError`) No production changes. ## Testing `mvn test -DskipAssembly -pl core -Dtest=AliasInterceptorTest` — 8/8 passing. 🤖 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]
