The NPE appears to be thrown within a rule compiled in the RETE network. Does $alarmTime.getTime() return null at the time facts are asserted?
The call to getTime() will be made when facts are asserted but the RHS will not be called until you FireAllRules(). If you initialise the objects between assertion and firing the rules a NPE can occur. Cheers, Mike -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of seeker Sent: 09 May 2007 11:45 To: [email protected] Subject: [rules-users] Drools bug ?? (3.0.6) I use Drools 3.0.6 and I get some NullPointerException when creating my facts: Exception in thread "main" org.drools.RuntimeDroolsException: java.lang.NullPointerException at org.drools.rule.EvalCondition.isAllowed(Unknown Source) at org.drools.reteoo.EvalConditionNode.assertTuple(Unknown Source) at org.drools.reteoo.TupleSource.propagateAssertTuple(Unknown Source) at org.drools.reteoo.JoinNode.assertObject(Unknown Source) at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown Source) at org.drools.reteoo.AlphaNode.assertObject(Unknown Source) at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown Source) at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown Source) at org.drools.reteoo.Rete.assertObject(Unknown Source) at org.drools.reteoo.ReteooRuleBase.assertObject(Unknown Source) at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown Source) at org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source) at org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source) ... Caused by: java.lang.NullPointerException at org.sercho.shem.rules.Rule_Zeittest_0.eval0(Rule_Zeittest_0.java:25) at org.sercho.shem.rules.Rule_Zeittest_0Eval0Invoker.evaluate(Rule_Zeittest _0Eval0Invoker.java:19) ... 21 more The rule that is causing this goes like this: rule "Zeittest" when room : Room ( ) uhr : AlarmClock( applianceStateResource == ApplianceStateEnum.on, location == room, $alarmTime : alarmTime ) eval( $alarmTime.getHours() > 10 ) then ... If I omit the eval, ths error will not occur (and I can access $alarmTime.getHours() in RHS) I wonder if I do something wrong or if it is a Drools bug. Any hints ? -- View this message in context: http://www.nabble.com/Drools-bug----%283.0.6%29-tf3715030.html#a10392045 Sent from the drools - user mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
