I've just helped a user correct a configuration mistake where they'd tried to configure a DataSize with a string of 2KB. This resulted in a conversion failure due to the trailing whitespace as neither StringToDataSizeConverter nor DataSize.parse trims the input. By contrast other areas of Framework such as CustomBooleanEditor do trim before attempting conversion.

Could the various property editors and converters be updated to consistently trim whitespace when it's irrelevant to the target type?

Comment From: sbrannen

I agree that it makes sense to trim the input in DataSize.parse and other converters in Spring Framework. We'll investigate where such trimming would be appropriate.

Since StringToDataSizeConverter is in Spring Boot, however, you could apply trimming there.

Comment From: sbrannen

I have repurposed this issue to focus on DataSize parsing and introduced the following issues to address PropertyEditors and Converters.

  • 28755

  • 28756