If it works fine with an and operator then I’d imagine that startDate < $regDate returns false, with an && this would abort evaluation immediately but with
an or it would mean that startDate > endDate is evaluated and so presumably it is this bit that is throwing the NPE. I’d imagine that the most likely reason for this would be that endDate is null.
Try changing it too
Segment ( startDate < $regDate || (endDate != null && startDate > endDate) )
And see whether you loose the NPE.
Thomas
From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
On Behalf Of dhari
Sent: 23 February 2010 06:15
To: rules-users@lists.jboss.org
Subject: [rules-users] Comparing Date with || OR operator
The following code generates NPE in ReteTuple.java
rule
when
Membership ( $regDate : regDate)
Segment ( startDate < $regDate || startDate > endDate )
then
System.err.print(“Invalid start date”);
end
I am new in Drools and don’t know much about DRL scripting. It works fine I use && operator instead.
View this message in context:
Comparing Date with || OR operator
Sent from the Drools - User mailing list archive at Nabble.com.