[ 
https://issues.apache.org/jira/browse/WW-5871?focusedWorklogId=1056510&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1056510
 ]

ASF GitHub Bot logged work on WW-5871:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 22/Nov/26 14:03
            Start Date: 22/Nov/26 14:03
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart merged PR #2154:
URL: https://github.com/apache/struts/pull/2154




Issue Time Tracking
-------------------

    Worklog Id:     (was: 1056510)
    Time Spent: 0.5h  (was: 20m)

> Request parameters bound to String properties are trimmed since 7.5.0
> ---------------------------------------------------------------------
>
>                 Key: WW-5871
>                 URL: https://issues.apache.org/jira/browse/WW-5871
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 7.5.0
>            Reporter: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.6.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> WW-3666 trims surrounding whitespace before converting a value to a 
> non-String type, and String targets are meant to keep the raw value. Since 
> 7.5.0, however, a request parameter bound to a String property is trimmed too.
> A request parameter reaches {{XWorkBasicConverter.convertValue}} as a 
> {{String[]}}. The early return skips conversion only when the value's class 
> already matches the target type, so a {{String[]}} passes it. The trim step 
> then trims every element, because it excludes arrays, collections and 
> Character targets but not String, and the trimmed element is converted to 
> String.
> {code:java}
> converter.convertValue(context, null, null, null, new String[]{" summer2026 
> "}, String.class);
> // 7.4.0: " summer2026 "
> // 7.5.0: "summer2026"
> converter.convertValue(context, null, null, null, " summer2026 ", 
> String.class);
> // " summer2026 " on both - the early return covers a bare String
> {code}
> The test added with WW-3666 covers only the bare String case, which never 
> reaches the trim.
> Impact: any String property loses leading and trailing whitespace, for 
> example a password that starts or ends with a space no longer matches after 
> the upgrade.
> Reported on the user list.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to