You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Biestro (JIRA)" <ji...@apache.org> on 2015/07/25 14:11:05 UTC

[jira] [Commented] (JEXL-169) A string is wrongly identified as FloatingPointNumber

    [ 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)