[
https://issues.apache.org/jira/browse/WW-5757?focusedWorklogId=1045761&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1045761
]
ASF GitHub Bot logged work on WW-5757:
--------------------------------------
Author: ASF GitHub Bot
Created on: 05/Oct/26 15:35
Start Date: 05/Oct/26 15:35
Worklog Time Spent: 10m
Work Description: sonarqubecloud[bot] commented on PR #1990:
URL: https://github.com/apache/struts/pull/1990#issuecomment-5997732509
## [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1990)
**Quality Gate passed**
Issues
 [0 New
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1990&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1990&issueStatuses=ACCEPTED)
Measures
 [0 Security
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=1990&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1990&metric=new_coverage&view=list)
 [0.0% Duplication on New
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1990&metric=new_duplicated_lines_density&view=list)
<!
Issue Time Tracking
-------------------
Worklog Id: (was: 1045761)
Time Spent: 50m (was: 40m)
> BeanValidationInterceptor resolves the interpolated constraint message as a
> text key instead of the message template
> --------------------------------------------------------------------------------------------------------------------
>
> Key: WW-5757
> URL: https://issues.apache.org/jira/browse/WW-5757
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Bean Validation
> Reporter: Lukasz Lenart
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 6.13.0, 7.5.0
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> {{BeanValidationInterceptor}} builds the field and action error text from
> {{ConstraintViolation.getMessage()}}, which is the message *after* the Bean
> Validation provider has interpolated it, and passes that string to the Struts
> text provider ({{getText(...)}}) as the text key.
> The key a developer declares is the constraint's {{message}} attribute, which
> is what {{ConstraintViolation.getMessageTemplate()}} returns. Using the
> interpolated message as the key means:
> * a developer-declared Struts key only resolves when the provider leaves the
> message untouched;
> * provider-interpolated text that matches no key is not shown as the provider
> produced it, but is handed to the text provider as default text and processed
> again, as if it were a Struts message.
> The plugin documentation only promises that the {{message}} value is looked
> up as a Struts key; it does not say that provider-produced text goes through
> the text provider.
> h2. Change
> Resolve the error text from the template, and keep the provider's message
> otherwise:
> * look up {{getMessageTemplate()}} in the Struts bundles, and call
> {{getText}} with it only when {{hasKey}} finds it;
> * otherwise use {{ConstraintViolation.getMessage()}} as-is, as literal text;
> * never pass the interpolated message to any text-provider method
> ({{getText}}, {{hasKey}}, {{findText}}).
> h2. Tests
> * A constraint whose provider-interpolated message contains text that the
> Struts text provider would otherwise process is reported exactly as the
> provider produced it.
> * Existing tests where {{message}} is a Struts key keep resolving through the
> bundle.
> Apply the same change on the 6.x line.
> h2. Documentation
> The Bean Validation plugin page should state that {{message}} is looked up as
> a Struts key, and that a message produced by the provider is shown literally.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)