[rules-users] first steps with drools.....first errors

Nicola Benaglia nicola.benaglia at tecno-progetti.eu
Thu Sep 18 10:29:45 EDT 2008


Hi Edison,
I tried your suggestion but I received an exception when I pass a null
value.
The exception is:

Exception in thread "main" java.lang.NullPointerException
    at java.math.BigDecimal.compareTo(BigDecimal.java:2461)
    at
org.drools.base.evaluators.BigDecimalFactory$BigDecimalLessEvaluator.evaluate(BigDecimalFactory.java:235)
    at
org.drools.rule.VariableRestriction.isAllowed(VariableRestriction.java:73)
    at
org.drools.rule.VariableConstraint.isAllowed(VariableConstraint.java:67)
    at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
    at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
    at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
    at org.drools.reteoo.Rete.assertObject(Rete.java:175)
    at
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
    at
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
    at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:911)
    at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
    at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:684)

I attach some file to test this.

Thank you
Nicola



Edson Tirelli ha scritto:
>
>    You syntax is wrong. Fixing your syntax is as easy as saying:
>
> exists ExamDetail( authLimit != null )
>
>    But I think that your rules can be simplified by simply writing:
>
> rule "Rule n.1"
> dialect "mvel"
> no-loop true
> salience 10
>    when
>        $examDetail : ExamDetail( $value: value < authLimit);
>    then
>        System.out.println( "1 Exam passed!" + $value);
> end
>
> rule "Rule n.2"
> dialect "mvel"
> no-loop true
> salience 10
>    when
>        not ExamDetail( value < authLimit );
>    then
>        System.out.println( "2 Exam passed! + $value);
> end
>
>
>    This should cover both of your scenarios.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: check.drl
Url: http://lists.jboss.org/pipermail/rules-users/attachments/20080918/f5abde60/attachment.pl 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ExamCheck.java
Type: text/x-java
Size: 910 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20080918/f5abde60/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ExamDetail.java
Type: text/x-java
Size: 403 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20080918/f5abde60/attachment-0001.bin 


More information about the rules-users mailing list