[rules-users] Drools bug ?? (3.0.6)

Edson Tirelli tirelli at post.com
Wed May 9 09:46:45 EDT 2007


   You are probably asserting an AlarmClock fact whose alarmTime field is
set to null.

   It is easy to check if that is the case. Change your constraints to:

uhr : AlarmClock( applianceStateResource == ApplianceStateEnum.on,
location == room, $alarmTime : alarmTime != null )

   And the NPE should stop.

   []s
   Edson


2007/5/9, seeker <janko.dimitroff at dai-labor.de>:
>
>
> 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070509/b1d06e7f/attachment.html 


More information about the rules-users mailing list