[rules-users] Comparing Date with || OR operator

Swindells, Thomas TSwindells at nds.com
Tue Feb 23 06:54:41 EST 2010


Have you got the stack trace, that may give a clue? Also what are the actual values of start date and end date?

Thomas


From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of dhari
Sent: 23 February 2010 11:30
To: rules-users at lists.jboss.org
Subject: Re: [rules-users] Comparing Date with || OR operator

Hi Thomas

Thanks your prompt reply. I am sure all three attributes are NOT null. I have tested them before sending question to mailing list. If you want, I can send complete sample code and you can try it at your end.

Regards,
Dhari


________________________________
Date: Tue, 23 Feb 2010 02:50:08 -0800
From: [hidden email]<http://n3.nabble.com/user/SendEmail.jtp?type=node&node=383423&i=0>
To: [hidden email]<http://n3.nabble.com/user/SendEmail.jtp?type=node&node=383423&i=1>
Subject: Re: Comparing Date with || OR operator

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: [hidden email] [mailto:[hidden email]] On Behalf Of dhari
Sent: 23 February 2010 06:15
To: [hidden email]
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.

________________________________

**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the [hidden email] and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
________________________________
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the [hidden email] and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes.
To protect the environment please do not print this e-mail unless necessary.

An NDS Group Limited company. www.nds.com

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users

________________________________
View message @ http://n3.nabble.com/Comparing-Date-with-OR-operator-tp347656p379447.html
To unsubscribe from Drools - Java Rules Engine, click here.

________________________________
Find your next place with Ninemsn property Looking for a place to rent, share or buy?<http://clk.atdmt.com/NMN/go/157631292/direct/01/>
________________________________
View this message in context: RE: Comparing Date with || OR operator<http://n3.nabble.com/Comparing-Date-with-OR-operator-tp347656p383423.html>
Sent from the Drools - User mailing list archive<http://n3.nabble.com/Drools-User-f47000.html> at Nabble.com.

________________________________

**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************

________________________________
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes.
To protect the environment please do not print this e-mail unless necessary.

An NDS Group Limited company. www.nds.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100223/97acd5f2/attachment.html 


More information about the rules-users mailing list