I'm new to drools, so hopefully I can post enough information to get some help. We
are running Drools 5.3.3.Final (though we've seen the same issue with 5.4.0.Final and
5.3.0.Final)
I'm trying to test some rules created in drl format. Here's an example of a drl
that executes fine – it checks a birthday field against a date literal:
------------------------------------------
package drools.rules.funnelid.two
import com.infusionsoft.bpm.services.TestRuleFact;
rule "Test Rule"
dialect "java"
when
$testRuleFact : TestRuleFact( ( contactable.contact.birthday < "29-Dec-1977"
) )
then
$testRuleFact.setTrue( );
end
-------------------------------------------
However, this drl fails compilation with the following error:
package drools.rules.funnelid.two
import com.infusionsoft.bpm.services.TestRuleFact;
rule "Test Rule"
dialect "java"
when
$testRuleFact : TestRuleFact( ( contactable.contact.title str[equals] "Owner"
&& contactable.contact.birthday < "01-Jan-1980" ) || (
contactable.contact.country str[equals] "USA" &&
contactable.contact.leadSourceIdOverride == "12" ) )
then
$testRuleFact.setTrue( );
End
------------------------------------------
Here's the error I get:
DRL contains errors, no actions will be processed: Unable to Analyse Expression
str0.evaluate( contactable.contact.title, "Owner" ) &&
contactable.contact.birthday < "01-Jan-1980" || str1.evaluate(
contactable.contact.country, "USA" ) &&
contactable.contact.leadSourceIdOverride == "12":
[Error: Comparison operation requires compatible types. Found class java.util.Date and
class java.lang.String]
[Near : {... ) && contactable.contact.leadSourceIdOverride == "12"
....}]
^
[Line: 8, Column: 32] : [Rule name='Test Rule']
Some things that cause the error to go away:
* Removing the offending clause: contactable.contact.birthday <
"01-Jan-1980"
* Changing the || to an &&
I'm at a loss and would love some help. Even if I knew which class was raising the
exception would help, but I can't seem to find it anywhere.
Thanks,
Eric