[
https://issues.apache.org/jira/browse/JEXL-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17815516#comment-17815516
]
Xu Pengcheng commented on JEXL-420:
-----------------------------------
I agree that not weaken the type system, but in Java, usually the 'equals'
method should handle type diff and return false instead of throwing exception.
For java object in JEXL, '==' Equality uses the java equals method, for numeric
values, I think it is good to try parsing non-numeric object for comparison,
but personally I think returns false for parsing failure is more consistently,
and if so, the historic convenient exception for empty string is no need any
more.
Thanks!
> Error while comparing float and string value
> --------------------------------------------
>
> Key: JEXL-420
> URL: https://issues.apache.org/jira/browse/JEXL-420
> Project: Commons JEXL
> Issue Type: Bug
> Reporter: Xu Pengcheng
> Priority: Major
>
> code:
> {code:java}
> 1.2 == ''{code}
> returns false
>
> code:
> {code:java}
> 1.2 == 'a'{code}
> causes exception
> {code:java}
> Caused by: java.lang.ArithmeticException: Double coercion: (a){code}
>
> Is it possible to check the right side is a number like string and return
> false if not?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)