You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sharon Ben Asher (JIRA)" <ji...@apache.org> on 2019/04/18 08:07:00 UTC

[jira] [Created] (JEXL-297) validate expression (instead of evaluate)

Sharon Ben Asher created JEXL-297:
-------------------------------------

             Summary: validate expression (instead of evaluate)
                 Key: JEXL-297
                 URL: https://issues.apache.org/jira/browse/JEXL-297
             Project: Commons JEXL
          Issue Type: New Feature
    Affects Versions: 3.1
            Reporter: Sharon Ben Asher


My project uses JEXL to both validate and evaluate expressions.

Let me explain: 

The product has an excel-like feature and two stages:

In the "design" stage, a user may enter a literal OR a formula in input fields. fields are either numeric-typed or boolean-typed, so an expression may be numeric or boolean. the expressions may contain variables. In the "production" stage, the expressions are evaluated. variables get values from the DB.  

During the design, we are validating the expressions and alert the user if there are syntax errors. at that time, validation is using JEXL to evaluate the expression and examines the result for exceptions or error responses. the variables are assigned some default value. 

The problem I am having is to come up with default values that will not cause errors not related to syntax (like division by zero) I am encountering all kinds of arithmetic exceptions that are because of values and not because of syntax. 

So perhaps JEXL can support "syntax validation" feature, where variables can be "any value that is valid at this position"



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)