You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Ramesh Dhungel (Jira)" <ji...@apache.org> on 2019/11/02 15:19:00 UTC

[jira] [Commented] (LANG-1484) NumberUtils.isParsable returns false for strings ending with .

    [ https://issues.apache.org/jira/browse/LANG-1484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16965401#comment-16965401 ] 

Ramesh Dhungel commented on LANG-1484:
--------------------------------------

In the test class NumberUtils.isParsable there is a assert false for 64. in line 1457. So NumberUtils.isParsable("100.") will return false because of that line. So you could either have a new code that would eliminate last char of that argument and then pass it in to the method withDecimalsParsing which would return 100.0 or 64.0. Thus it would be true an matches Double.parseDouble(). But you cant have one test case that returns false with similar or exact argument and then have another test case that should return true with the same argument. So I think what we can do is take out one of the test case and decide which one to keep because all the other test cases pass. 

> NumberUtils.isParsable returns false for strings ending with .
> --------------------------------------------------------------
>
>                 Key: LANG-1484
>                 URL: https://issues.apache.org/jira/browse/LANG-1484
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.math.*
>    Affects Versions: 3.8.1
>         Environment: Tested on Linux with OpenJDK 10.0.2 and Windows with Oracle Java 8 Update 201.
>            Reporter: Kyle Dodson
>            Priority: Minor
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> From the Javadocs:
> {quote}Parsable numbers include those Strings understood by ... Double.parseDouble(String).
> {quote}
> {{Double.parseDouble("100.")}} returns a valid double (it does not throw a {{NumberFormatException}}); however, {{NumberUtils.isParsable("100.")}} returns {{false}}.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)