Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce lenient parsing in DataSize regarding whitespace #28643

Closed
wilkinsona opened this issue Jun 16, 2022 · 2 comments
Closed

Introduce lenient parsing in DataSize regarding whitespace #28643

wilkinsona opened this issue Jun 16, 2022 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@wilkinsona
Copy link
Member

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?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 16, 2022
@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 17, 2022
@sbrannen sbrannen self-assigned this Jun 17, 2022
@sbrannen sbrannen added this to the 5.3.22 milestone Jun 17, 2022
@sbrannen
Copy link
Member

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.

@sbrannen sbrannen changed the title Trim string input during type conversion where whitespace is irrelevant to the target type Introduce lenient parsing in DataSize regarding whitespace Jul 4, 2022
@sbrannen
Copy link
Member

sbrannen commented Jul 4, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants