You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@struts.apache.org by "lukaszlenart (via GitHub)" <gi...@apache.org> on 2026/07/26 08:18:30 UTC

[PR] WW-3427 Add regression test for conversion errors on aliased properties [struts]

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: notifications-unsubscribe@struts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] WW-3427 Add regression test for conversion errors on aliased properties [struts]

Posted by "lukaszlenart (via GitHub)" <gi...@apache.org>.
lukaszlenart merged PR #1814:
URL: https://github.com/apache/struts/pull/1814


-- 
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: notifications-unsubscribe@struts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] WW-3427 Add regression test for conversion errors on aliased properties [struts]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #1814:
URL: https://github.com/apache/struts/pull/1814#issuecomment-5082722637

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1814) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1814&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1814&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=1814&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1814&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1814&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1814)
   
   


-- 
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: notifications-unsubscribe@struts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org