Question

Let say i have a below expression that needs to be evaluated using MVEL.

( ( ( A * B ) + C ) / D )

suppose value of B is NULL, then MVEL evaluates "A * B" as FALSE. "(A * B) + C" becomes FalseC Then FalseC/D throws exception

How to prevent this...??

Was it helpful?

Solution

As of now we solved this be below approach. If you actually debug this in Mvel API classes, they are explicitly returning false for this particular case. If Mvel can fix this, it will be good. But this same issue i also encountered, so what we did, we created some intelligence before executing the expression, we modified the expression and included "IF" condition to check for the fields that are null and having operator as "/" or "*", the return null.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top