Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Not A Bug
-
Affects Version/s: 2.0.17
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Mac OSX 10.6
JDK 1.6
-
Testcase included:yes
-
Number of attachments :
Description
The bracket is not working properly in the logical expression like '(1 == 1) and (2 > 1)'. It is working fine without bracket.
Here is the test case:
public void testCalculate4() {
Map vars = new LinkedHashMap();
String[] testCases =
{ "(1 == 1) and (2 > 1)",// "(1 == 1) and (2 > 1) and (3!=4) and (4!=3)",// "( 2 + 3 > 4 ) and ( 8 - 5 > 2 )",// "(2+3>4) and (8-5>2)",// "1 == 1 and 2 > 1 and (3!=4 and 4!=3)" // };
for (String expr : testCases)
{ log.info("Evaluating '" + expr + "': ......"); Object ret = MVEL.eval(expr, vars); log.info("'" + expr + " ' = " + ret.toString()); Assert.assertNotNull(ret); // test in compile mode Serializable compiled = MVEL.compileExpression(expr); ret = MVEL.executeExpression(compiled, vars); log.info("'" + expr + " ' = " + ret.toString()); Assert.assertNotNull(ret); }}