Hello,

First of all, I'd like to thank all the people involved in making this tool such a great one (this includes whoever writes the reference manual as well).

I've been having some problems when comparing BigDecimals (using the compareTo method). I didn't find this issue in any previous post or in Drools' JIRA. However, I've been using Drools for a short time, so I hope you people can help me.

The problem:

Firing this (simple) rule:

rule "Test Rule"
  when
      $dec : java.math.BigDecimal() from java.math.BigDecimal.TEN;
      eval( $dec.compareTo(java.math.BigDecimal.ONE) > 0 )
  then
      System.out.println("OK!");
end

Fires this exception:

org.drools.RuntimeDroolsException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigDecimal
at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:76)
at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:145)
at org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple(SingleTupleSinkAdapter.java:20)
at org.drools.reteoo.FromNode.assertTuple(FromNode.java:90)
at org.drools.reteoo.SingleTupleSinkAdapter.createAndPropagateAssertTuple(SingleTupleSinkAdapter.java:55)
at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(ReteooWorkingMemory.java:179)
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1315)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:462)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:433)
at com.sample.DroolsTest.main(DroolsTest.java:33)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigDecimal
at com.sample.Rule_Test_Rule_0Eval0Invoker.evaluate(Rule_Test_Rule_0Eval0Invoker.java:12)
at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:72)
... 14 more

I've reported the issue in JIRA (http://jira.jboss.com/jira/browse/JBRULES-1433)

Best regards,
José