reject hex-float and suffixed values in Converter.NUMBER#431
reject hex-float and suffixed values in Converter.NUMBER#431rootvector2 wants to merge 2 commits into
Conversation
garydgregory
left a comment
There was a problem hiding this comment.
@rootvector2
Please see my question.
| new BigDecimal(s); | ||
| return Double.valueOf(s); |
There was a problem hiding this comment.
Why not just:
| new BigDecimal(s); | |
| return Double.valueOf(s); | |
| return new BigDecimal(s).doubleValue(); |
?
There was a problem hiding this comment.
no reason, the second parse was redundant. switched to new BigDecimal(s).doubleValue() and pushed. only difference is -0.0 now parses as positive zero since BigDecimal has no signed zero, which doesn't matter here.
There was a problem hiding this comment.
Please review the code you submit more thoroughly BEFORE you create a PR.
There was a problem hiding this comment.
fair enough. the redundant parse should have been caught before opening this, I'll be more thorough.
|
Hello @rootvector2 |
|
the rejected forms are not really decimal formats, they are Java literal syntax leaking through |
|
Let's this one sit for now. |
|
sure, no rush. |
|
I converted this PR to a draft PR. |
NUMBERroutes any value containing.toDouble.valueOf, which also accepts hexadecimal floating point (0x1.8p1), type suffixes (1.0d,1.0f) and surrounding whitespace, so a strictBigDecimalparse now rejects those the way the integer branch already does.Before you push a pull request, review this list:
mvn; that'smvnon the command line by itself.