commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Biestro (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JEXL-169) A string is wrongly identified as FloatingPointNumber
Date Sat, 25 Jul 2015 12:11:05 GMT

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

Henri Biestro commented on JEXL-169:
------------------------------------

JexlArithmetic.isFloatingPointNumber() will use the following regexp:
{code}
    /**
     * The float regular expression pattern.
     */
    public static final Pattern FLOAT_PATTERN = Pattern.compile("^[+-]?\\d*(\\.\\d*)?([eE]?[+-]?\\d*)?$");
{code}

> A string is wrongly identified as FloatingPointNumber
> -----------------------------------------------------
>
>                 Key: JEXL-169
>                 URL: https://issues.apache.org/jira/browse/JEXL-169
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 2.1.1
>            Reporter: Robert Ne├čelrath
>            Assignee: Henri Biestro
>            Priority: Minor
>             Fix For: 3.0
>
>
> When concatenating two strings with one containing an 'e' character, an ArithmeticException
is thrown.
> The problem lies in the JexlArithmetic.isFloatingPointNumber() method in line 200.
> return ((string.indexOf(46) != -1) || (string.indexOf(101) != -1) || (string.indexOf(69)
!= -1));
> With this solution also the String "New York" or "hello.world" are floating point numbers.
A solution with a regular expression would be better



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message