]
r1 b2 commented on DROOLS-476:
------------------------------
Hi, this bug is still present, any change it gets resolved soon ?
NPE when MVEL parses arithmetic expression
------------------------------------------
Key: DROOLS-476
URL:
https://issues.jboss.org/browse/DROOLS-476
Project: Drools
Issue Type: Bug
Affects Versions: 5.5.0.Final
Environment: sun JDK 1.6;
Drools 5.5.0Final
Reporter: Hassler Jean-Christian
Assignee: Mark Proctor
Labels: mvel, parsing
When user write computations with MVEL, mvel throw the error {color:red}[Error: not a
statement, or badly formed structure] {color}at parsing time.
If you add parenthesis, parsing is OK.
The issue can be reproduced directly with the lastest MVEL version.
As you can see in the test below, same expression with parenthesis is OK. Debugging into
mvel engine shows that there some nullPointerException in the bad case.
This issue was reproduced with the MVEL version embedded inside Drools 5.5.0Final and
also with MVEL version 2.1.9.Final.
{code:java}
public class MvelTest {
public void test(){
String expressionThatDoesNotWork = "5 + 1/10 * (VAR - 5)"; // !!! mvel cannot
parse this expression
String expressionThatWorks = "5 + (1/10) * (VAR - 5)"; //with additionnal
parenthesis it's OK
Serializable parsingResultOK = MVEL.compileExpression(expressionThatWorks); //this
works seamlessly
System.out.println(parsingResultOK); //=> (Literal<5> + (Literal<0.1> *
(VAR - Literal<5>)))
Serializable failedResult = MVEL.compileExpression(expressionThatDoesNotWork); // !!!
this throws NullPointerException in MVEL engine
}
}
{code}