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

Specify NumberUtils.parseNumber() trim behavior in the javadoc [SPR-9523] #14157

Closed
spring-issuemaster opened this Issue Jun 20, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

spring-issuemaster commented Jun 20, 2012

Penny Rohr opened SPR-9523 and commented

Prior to performing conversion, NumberUtils is removing all whitespace from input string instead of removing only leading/trailing whitespace. This results in incorrect conversions instead of expected exceptions. As an example, calling NumberUtils.parseNumber("2 3", Double.class) will result in a new Double("23").


Affects: 3.0.5, 3.1.1

Referenced from: commits 78a6429

1 votes, 3 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator

spring-issuemaster commented Aug 6, 2012

Chris Beams commented

What would you expect to NumberUtils.parseNumber("2 3", Double.class) to return?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator

spring-issuemaster commented Aug 6, 2012

Penny Rohr commented

I would expect this to generate some kind of exception. "2 3" is not a valid number format.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator

spring-issuemaster commented Dec 28, 2018

Sébastien Deleuze commented

I think the current behavior is correct, it is probably used in various application where you input credit card number or other use cases like that where in between space characters are usual, so I turn this issue into a Javadoc improvement one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment