[rules-users] Error in MVEL execution (optimization?)

Mario Fusco mario.fusco at gmail.com
Thu Jan 5 12:08:42 EST 2012


Hi, 

I was investigating this issue and just found the cause of the double
evaluation of the pattern. The problem is in the
EqualityEvaluatorsDefinition.BooleanEqualEvaluator.evaluate() method:

https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/base/evaluators/EqualityEvaluatorsDefinition.java#L552

As you can see here the extractor is invoked twice: first with isNullValue()
and then with getBooleanValue() and both these invocations cause in turn the
evaluation of the pattern. 

Unfortunately this is necessary to avoid a NullPointerException when
unboxing the primitive type. The (ugly) alternative would be to just invoke
the getBooleanValue() method in a try/catch block and act accordingly when a
NPE is thrown.

The good news is that I just finished to develop a totally new (and faster)
implementation of constraints evaluation. I already checked that this new
implementation doesn't suffer of this issue and it will be available in
Drools 5.4.

Mario

--
View this message in context: http://drools.46999.n3.nabble.com/Error-in-MVEL-execution-optimization-tp3633440p3635557.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list