Trim all whitespaces before parsing a given DataSize string so that the parsing is more robust

This relates to the following issue in Spring Framework: https://github.com/spring-projects/spring-framework/issues/28643 since one of the maintainers recommended a fix in StringToDataSizeConverter in SpringBoot.

Closes gh-28357

Comment From: wilkinsona

Thanks for the PR. The Framework team may decide to trim the input in DataSize.parse in which case the changes proposed here won't be necessary. I'll place this on hold until the changes have been made in Framework.

Comment From: kevin0x90

Thanks for the feedback what do you think about applying the fix in spring framework? In the original issue there was a discussion about a general solution that would include Converters.

Comment From: wilkinsona

I would apply the fix as close as possible to the parsing. Many times, that would mean that it will go in the converter itself. In the case of DataSize, it would go in its parse method to which the converter delegates.

Comment From: kevin0x90

@wilkinsona ok then i would apply the fix directly in the DataSize class at first and create a separate PR in the spring framework and leave the Converters untouched at the moment.

So from my perspective this PR could be closed then.

Comment From: sbrannen

ok then i would apply the fix directly in the DataSize class at first and create a separate PR in the spring framework

@kevin0x90, please do not submit a PR to Spring Framework for that change. https://github.com/spring-projects/spring-framework/issues/28643 is assigned to me for the 5.3.22 release, and I will address trimming in DataSize as well as other related areas as appropriate.

Comment From: kevin0x90

@sbrannen ok then i would close this PR. Thanks for the feedback.