I'm working with Drools 5.4, and have been experiencin an NPE in a block of code similar to this:
rule "NPE sometimes"
when
$person : Person((name == null || name.last == null || name.last.empty),
person.uniqueId != null)
then
log.error("Person has unique ID, but no last name");
end
The error occurs when it appears that the middle expression is attempted to be evaluated out of order:
Exception in thread "Thread-18" [Error: null pointer or function not found: last]
[Near : {... name == null || name.last == null || name....}]
^
I know that the rules engine attempts to optimize where possible. Is this kind of expression not allowed, or subject to optimization?