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: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of seeker
Sent: 09 May 2007 11:45
To: rules-users(a)lists.jboss.org
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
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users