Thanks for the feedback. Assuming I really have a null somewhere (rather than a drools bug), how would I go about debugging this? Since the crash occurs in the rule class generated at runtime, I cannot set a breakpoint to look at which values might be null. Any advice on this?
Thanks, -Chris West On 2/21/07, Edson Tirelli <[EMAIL PROTECTED]> wrote:
Chris, The following must work just fine: Person( girlAge : age, sex = "F" ) not Person( boyAge : age -> ( girlAge.intValue() == boyAge.intValue() + 2 ), sex = 'M' ) The only reason I can see for that to fail is if age is an object type attribute (Integer, Double, etc) and it is set to null. Otherwise, it is probably a bug. Bellow is not supposed to work: Person( girlAge : age, sex = "F" ) not Person( boyAge : age, sex = 'M' ) eval ( girlAge.intValue() == boyAge.intValue() + 2 ) The reason is because "not" means you DON'T have a Person object with that attributes (the boy), so you can't eval anything using "boyAge". []s Edson Chris West wrote: > Does anyone know if there is a problem using a "not" combined with a > predicate expression? Drools gives me a NullPointerException > sometimes when evaluating my predicate. The example from the user > guide is: > > Person( girlAge : age, sex = "F" ) > Person( boyAge : age -> ( girlAge.intValue() == boyAge.intValue() + 2 > ), sex = 'M' ) > > Buy I'm trying something similar to: > > Person( girlAge : age, sex = "F" ) > not Person( boyAge : age -> ( girlAge.intValue() == boyAge.intValue() > + 2 ), sex = 'M' ) > > And also: > > Person( girlAge : age, sex = "F" ) > not Person( boyAge : age, sex = 'M' ) > eval ( girlAge.intValue() == boyAge.intValue() + 2 ) > > Is there anything wrong with these? The compiler does not have a > problem with the former, but does not like the latter. I'm using > Drools 3.0.5. I'm basically trying to say "there is a girl, and there > is not a boy whose age is 2 years less than the girl". > > Any thoughts on this would be greatly appreciated. > > Thanks, > -Chris West > _______________________________________________ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3124-6000 Mobile: +55 11 9218-4151 JBoss, a division of Red Hat @ www.jboss.com _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users