<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Segment ( $endDate : endDate, startDate < $regDate || startDate > $endDate ) even does not work. I am using verstion 5.0.1. All dates are java.util.Date and values in sample fact are:<br><br>regDate = Fri Aug 01 00:00:00 BST 2008<br>startDate = Tue Sep 01 00:00:00 BST 2009<br>endDate = Fri Jul 30 00:00:00 BST 2010<br><br>Stack trace: <br><br>java.lang.NullPointerException<br> at org.drools.reteoo.LeftTuple.get(LeftTuple.java:265)<br> at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300)<br> at org.drools.rule.VariableRestriction$ObjectVariableContextEntry.updateFromTuple(VariableRestriction.java:320)<br> at org.drools.rule.AbstractCompositeConstraint$MultiFieldConstraintContextEntry.updateFromTuple(AbstractCompositeConstraint.java:305)<br> at org.drools.common.SingleBetaConstraints.updateFromTuple(SingleBetaConstraints.java:119)<br> at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:109)<br> at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)<br> at org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:78)<br> at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:142)<br> at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)<br> at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)<br> at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)<br> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046)<br> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)<br> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)<br> at org.drools.reteoo.ReteooStatelessSession.execute(ReteooStatelessSession.java:192)<br> at au.gov.nsw.osr.zena.rules.AnnualRulesTester.main(AnnualRulesTester.java:57)<br><br><br>> Date: Tue, 23 Feb 2010 12:54:46 +0100<br>> From: wolfgang.laun@gmail.com<br>> To: rules-users@lists.jboss.org<br>> Subject: Re: [rules-users] Comparing Date with || OR operator<br>> <br>> Please try this rewrite of the 2nd CE:<br>> Segment ( $endDate : endDate, startDate < $regDate || startDate > $endDate )<br>> and report the outcome to the list, together with the Dools version<br>> you are using.<br>> Thank you.<br>> <br>> <br>> 2010/2/23 dhari <sdhari@hotmail.com>:<br>> > Hi Thomas<br>> ><br>> > Thanks your prompt reply. I am sure all three attributes are NOT null. I<br>> > have tested them before sending question to mailing list. If you want, I can<br>> > send complete sample code and you can try it at your end.<br>> ><br>> > Regards,<br>> > Dhari<br>> ><br>> ><br>> > ________________________________<br>> > Date: Tue, 23 Feb 2010 02:50:08 -0800<br>> > From: [hidden email]<br>> > To: [hidden email]<br>> > Subject: Re: Comparing Date with || OR operator<br>> ><br>> > If it works fine with an and operator then I’d imagine that startDate <<br>> > $regDate returns false, with an && this would abort evaluation immediately<br>> > but with an or it would mean that startDate > endDate is evaluated and so<br>> > presumably it is this bit that is throwing the NPE. I’d imagine that the<br>> > most likely reason for this would be that endDate is null.<br>> ><br>> ><br>> ><br>> > Try changing it too<br>> ><br>> > Segment ( startDate < $regDate || (endDate != null && startDate > endDate) )<br>> ><br>> > And see whether you loose the NPE.<br>> ><br>> ><br>> ><br>> > Thomas<br>> ><br>> ><br>> ><br>> > From: [hidden email] [mailto:[hidden email]] On Behalf Of dhari<br>> > Sent: 23 February 2010 06:15<br>> > To: [hidden email]<br>> > Subject: [rules-users] Comparing Date with || OR operator<br>> ><br>> ><br>> ><br>> > The following code generates NPE in ReteTuple.java<br>> ><br>> > rule<br>> ><br>> > when<br>> ><br>> > Membership ( $regDate : regDate)<br>> ><br>> > Segment ( startDate < $regDate || startDate > endDate )<br>> ><br>> > then<br>> ><br>> > System.err.print(“Invalid start date”);<br>> ><br>> > end<br>> ><br>> > I am new in Drools and don’t know much about DRL scripting. It works fine I<br>> > use && operator instead.<br>> ><br>> > ________________________________<br>> ><br>> > View this message in context: Comparing Date with || OR operator<br>> > Sent from the Drools - User mailing list archive at Nabble.com.<br>> ><br>> > ________________________________<br>> > **************************************************************************************<br>> > This message is confidential and intended only for the addressee. If you<br>> > have received this message in error, please immediately notify the [hidden<br>> > email] and delete it from your system as well as any copies. The content of<br>> > e-mails as well as traffic data may be monitored by NDS for employment and<br>> > security purposes. To protect the environment please do not print this<br>> > e-mail unless necessary.<br>> ><br>> > NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18<br>> > 4EX, United Kingdom. A company registered in England and Wales. Registered<br>> > no. 3080780. VAT no. GB 603 8808 40-00<br>> > **************************************************************************************<br>> ><br>> > ________________________________<br>> > This message is confidential and intended only for the addressee. If you<br>> > have received this message in error, please immediately notify the [hidden<br>> > email] and delete it from your system as well as any copies. The content of<br>> > e-mails as well as traffic data may be monitored by NDS for employment and<br>> > security purposes.<br>> > To protect the environment please do not print this e-mail unless necessary.<br>> ><br>> > An NDS Group Limited company. www.nds.com<br>> ><br>> > _______________________________________________<br>> > rules-users mailing list<br>> > [hidden email]<br>> > https://lists.jboss.org/mailman/listinfo/rules-users<br>> ><br>> ><br>> > ________________________________<br>> > View message @<br>> > http://n3.nabble.com/Comparing-Date-with-OR-operator-tp347656p379447.html<br>> > To unsubscribe from Drools - Java Rules Engine, click here.<br>> ><br>> > ________________________________<br>> > Find your next place with Ninemsn property Looking for a place to rent,<br>> > share or buy?<br>> > ________________________________<br>> > View this message in context: RE: Comparing Date with || OR operator<br>> > Sent from the Drools - User mailing list archive at Nabble.com.<br>> ><br>> > _______________________________________________<br>> > rules-users mailing list<br>> > rules-users@lists.jboss.org<br>> > https://lists.jboss.org/mailman/listinfo/rules-users<br>> ><br>> ><br>> <br>> _______________________________________________<br>> rules-users mailing list<br>> rules-users@lists.jboss.org<br>> https://lists.jboss.org/mailman/listinfo/rules-users<br>                                            <br /><hr /> Browse profiles for free! <a href='http://clk.atdmt.com/NMN/go/150855801/direct/01/' target='_new'>View photos of singles in your area.</a></body>
</html>