Hi Dan,

Thanks for the precise analysis. It is not intended, and your reading of
the cause is correct. The trim step excludes arrays, collections and
Character targets but not String, so a request parameter, which arrives as
String[], is trimmed before it is converted to String. The test added with
WW-3666 only covered a bare String, which takes the early return, so it
never caught this.

I filed it as WW-5871 [1] and the fix is targeted at 7.6.0.

Until then, a field-level type converter brings the old behaviour back for
the properties where whitespace matters. Field-level converters are looked
up before the default one, so the trim is never reached:

public class UntrimmedStringConverter extends StrutsTypeConverter {

    @Override
    public Object convertFromString(Map context, String[] values, Class
toClass) {
        return values.length == 0 ? null : values[0];
    }

    @Override
    public String convertToString(Map context, Object o) {
        if (o instanceof String[] values) {
            return values.length == 0 ? null : values[0];
        }
        return o == null ? null : o.toString();
    }
}

and next to the action class, in LoginAction-conversion.properties:

password=com.example.UntrimmedStringConverter

The String[] branch in convertToString is the important part: when the
target type is String, StrutsTypeConverter passes the raw request value to
convertToString, not convertFromString.

No need to send the test class, your three cases are enough to reproduce it.

[1] https://issues.apache.org/jira/browse/WW-5871


Regards
Łukasz

On Sun, Nov 22, 2026 11:06 AM, "Piche, Daniel via user" <
[email protected]> wrote:

> Hi Łukasz,
>
>
>
> After upgrading from 7.4.0 to 7.5.0, request parameters bound to String
> properties are trimmed, not only values converted to numbers, dates and
> other non-String types. WW-3666 and PR #2039 say String targets keep the
> value untouched, so this looks unintended.
>
>
>
> It seems to come from the early return in
> XWorkBasicConverter.convertValue: it skips only a value whose class already
> matches the target type. A request parameter arrives as String[], so it
> doesn’t match, each element is trimmed, and the result is then converted to
> String.
>
>
>
> Calling XWorkBasicConverter.convertValue directly:
>
>
>
> String[]{" summer2026 "} -> String   7.4.0: " summer2026 "    7.5.0:
> "summer2026"
>
> " summer2026 "           -> String   unchanged on both
>
> String[]{" 42 "}         -> Integer  7.4.0: conversion error  7.5.0: 42
> (the intended change)
>
>
>
> Where it hurts is a password field: a password that starts or ends with a
> space stops matching after the upgrade.
>
>
>
> Is this intended?
>
>
> I can send the small test class if it helps.
>
>
>
> Thanks,
>
>
>
> Dan
>
> --
>
> *Daniel Piché,* IDFusion Software
>
> Solution Architect, Digital and Technology Solutions
>
> Innovation & New Technology
>
> 1-204-292-2555
>
> *[email protected]* <[email protected]>
>
> *Confidentiality Notice**: This e-mail message (including any
> attachments) is confidential and may be subject to privilege, including
> Crown privilege. All rights to privilege are expressly claimed and not
> waived. It is strictly prohibited to use, copying, distribution or
> disclosure this message or any attachment, in whole or part, by anyone
> other than the intended recipient. If you have received this message in
> error, please delete this message, and all attachments, securely without
> making any copies and notify the sender immediately.*
>
>
>
>
>

Reply via email to