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

Optimize whitespace checks in StringUtils #31067

Closed
jhoeller opened this issue Aug 18, 2023 · 1 comment
Closed

Optimize whitespace checks in StringUtils #31067

jhoeller opened this issue Aug 18, 2023 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Milestone

Comments

@jhoeller
Copy link
Contributor

On review, StringUtils has some suboptimal whitespace checks: For hasText(String), it can use the JDK 11+ String.isBlank() method, and in trimAllWhitespace(CharSequence), it unnecessarily returns StringBuilder.toString() instead of just the StringBuilder itself.

@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Aug 18, 2023
@jhoeller jhoeller added this to the 6.0.12 milestone Aug 18, 2023
@jhoeller jhoeller self-assigned this Aug 18, 2023
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-5.3.x labels Aug 18, 2023
@jhoeller
Copy link
Contributor Author

While JDK 11's isBlank() can only be used in Spring Framework 6.0+, the other refinements can be backported to 5.3.x as well.

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) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant