WW-3427 Add regression test for conversion errors on aliased properties - #1814
Merged
lukaszlenart merged 2 commits intoJul 26, 2026
Merged
Conversation
Reproduce the WW-3427 scenario: an aliased property whose custom TypeConverter throws TypeConversionException. AliasInterceptor already reports such errors (setReportingConversionErrors on the secure child stack, then copies conversion errors back to the original ActionContext), but nothing exercised the alias + conversion-error path. The test drives an action through params -> alias -> conversionError and asserts the failure surfaces both in ActionContext.getConversionErrors() and as a field error, confirming WW-3427 is fixed. Removing the copy-back in AliasInterceptor makes it fail with "swallowed", proving it guards the behavior. Test-only; no production changes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
RAT flagged the new test resource as having an unapproved license. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes 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
TypeConverterthrowsTypeConversionException, the error is never caught byConversionErrorInterceptor/ConversionErrorFieldValidator.Why this is test-only
The defect is already fixed in current code.
AliasInterceptorbinds the alias on a secure child stack withsetReportingConversionErrors(context, true)and then copies the resulting conversion errors back into the originalActionContext:XWorkConverter.handleConversionExceptionrecords theTypeConversionExceptioninto that context, soConversionErrorInterceptorpicks it up downstream. This path was simply never covered by a test, and the ticket was never verified/closed.The test
AliasInterceptorTest#testConversionErrorOnAliasedPropertyIsReporteddrives an action throughparams -> alias -> conversionErrorwith an aliasedBigDecimalproperty bound through a converter that always throws, and asserts the failure surfaces both inActionContext.getConversionErrors()and as a field error on the aliased property.It genuinely guards the behavior: removing the copy-back in
AliasInterceptormakes the test fail with"conversion error for aliased property was swallowed", reproducing the original WW-3427 symptom.Files
AliasInterceptorTest.java— new test methodAliasConversionAction.java— action with an aliasedBigDecimal aliasDestThrowingTypeConverter.java— converter that always throwsTypeConversionExceptionAliasConversionAction-conversion.properties— registers the converter foraliasDestxwork-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