Please take a look on this PR, this is the intended behaviour I'm
going to implement in 7.5.1
https://github.com/apache/struts/pull/2159


Cheers
Łukasz


pon., 23 lis 2026 o 18:33 Lukasz Lenart <[email protected]> napisał(a):
>
> Yes, it is possible. Yet please consider helping us test the test
> builds before we call for Vote, or at least drop your Vote against a
> given version because you discovered a bug - this really could help us
> :)
> I'm going to prepare a new version, based on the STRUTS_7_5_0 tag,
> port the fix and start the Vote.
>
> Cheers
> Łukasz
>
> pon., 23 lis 2026 o 18:17 Tellis, Wyatt via user
> <[email protected]> napisał(a):
> >
> > Hi Lukasz,
> >
> > Since this could have significant impact on an application with unintended 
> > consequences, would it be possible to get a patch release (e.g. 7.5.1) 
> > instead of waiting for the next minor release.
> >
> > Wyatt
> >
> > ________________________________
> > From: Piche, Daniel via user <[email protected]>
> > Sent: Monday, November 23, 2026 1:09 AM
> > To: Lukasz Lenart <[email protected]>; [email protected] 
> > <[email protected]>
> > Cc: Piche, Daniel <[email protected]>
> > Subject: Re: [7.5.0] Values bound to String properties are now trimmed too
> >
> > !-------------------------------------------------------------------|
> >   This Message Is From an External Sender
> >   This message came from outside your organization.
> > |-------------------------------------------------------------------!
> >
> > Hi Lukasz,
> >
> > Thanks for the confirmation and the remedial implementation to use.
> >
> > Best,
> >
> > Dan
> > —
> >
> > Get Outlook for 
> > iOS<https://urldefense.com/v3/__https://aka.ms/o0ukef__;!!LQC6Cpwp!oDf3oeUcesEK8tflkXFmHGjbKVoBPf6QrprE9PmgeJMUZYBj8_mFx9iclxxFGCLRWx2mCIagjfblYSLSSr3O5w$
> >  >
> > ________________________________
> > From: Lukasz Lenart <[email protected]>
> > Sent: Sunday, 22 November 2026 19:25:09
> > To: [email protected] <[email protected]>
> > Cc: Piche, Daniel <[email protected]>
> > Subject: Re: [7.5.0] Values bound to String properties are now trimmed too
> >
> > 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
> >
> > 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://urldefense.com/v3/__https://issues.apache.org/jira/browse/WW-5871__;!!LQC6Cpwp!oDf3oeUcesEK8tflkXFmHGjbKVoBPf6QrprE9PmgeJMUZYBj8_mFx9iclxxFGCLRWx2mCIagjfblYSLw6XVmGA$
> >  
> > <https://urldefense.com/v3/__https://issues.apache.org/jira/browse/WW-5871__;!!IqQd2s6KUyvHwNLtrw!vcLi9BL2KIgBPKF0jBaPGJ5weRWRBCkFC_4B10Ky2BMulOts8wRg-ULa-NiWOy4DQPplU-gBAHQM71r1IJ0vCVlM9nO9$>
> >
> >
> > Regards
> > Łukasz
> >
> > On Sun, Nov 22, 2026 11:06 AM, "Piche, Daniel via user" 
> > <[email protected]<mailto:[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
> >
> > --
> >
> > [X]
> >
> > Daniel Piché, IDFusion Software
> >
> > Solution Architect, Digital and Technology Solutions
> >
> > Innovation & New Technology
> >
> > 1-204-292-2555
> >
> > [email protected]<mailto:[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.
> >
> >
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to