[jboss-jira] [JBoss JIRA] Resolved: (JBRULES-1205) AND works in a rule, but OR gives a classCastException
Edson Tirelli (JIRA)
jira-events at lists.jboss.org
Mon Sep 24 14:51:54 EDT 2007
[ http://jira.jboss.com/jira/browse/JBRULES-1205?page=all ]
Edson Tirelli resolved JBRULES-1205.
------------------------------------
Resolution: Done
Fixed. Problem was that LogicTransformer was not correctly cloning the declarations when cloning the patterns.
Thank you for reporting and, please, let us know if you find any other issue.
> AND works in a rule, but OR gives a classCastException
> ------------------------------------------------------
>
> Key: JBRULES-1205
> URL: http://jira.jboss.com/jira/browse/JBRULES-1205
> Project: JBoss Rules
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.0.1
> Environment: Win XP
> Reporter: Arsalan Zaidi
> Assigned To: Edson Tirelli
> Fix For: 4.0.2
>
>
> From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Edson Tirelli
> Sent: Tuesday, September 18, 2007 6:08 PM
> To: Rules Users List
> Subject: Re: [rules-users] Problem in using or operator with values in map.
>
> This seems a bug. May I ask you please to open a JIRA for it and attach a self contained test showing the problem?
> At the same time, I think there is a conceptual error in your rules: no object should be changed in the LHS of the rules. This will surely cause you problems in the future, so, I strongly advise you to rethink your rules.
> []s
> Edson
> 2007/9/18, Gaurav2007 <gaurav.a.joshi at capgemini.com>:
> Hi All,
> I am using drool 4.0.1,I am facing some problem in using or operator
> i am using 2 maps by inserting in to working memory:
> 1) ErrorMap<"String","String">
> 2) validationmap<String,Object>
> my requirment is to generate error when rule fails for this i am taking
> following steps:
> 1) i insert one entry in error map in when part and if that rule is success
> 2)i remove that entry from map and
> 3) at the end on the basis of this map i generates validation errors.
> import java.util.Map;
> import com.IValidationField;
> rule "ValueAllowed_G10.3"
> when
> IValidationField(attributeId =="G10.3")
> $map : Map( keySet contains "ErrorMap" )
> eval($map.put("G10.3_V","E_V_ALLOWED") == null || true)
> (or Map( this["G10.2"] not in("5"))
> Map( this["G10.2"] in("5")))
> then
> map.remove("G10.3_V ");
> System.out.println("comming
> here----------------------------------------->");
> end
> this file is giving classcast exception
> org.drools.RuntimeDroolsException: java.lang.ClassCastException :
> com.ValidationFieldImpl
> at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:75)
> at
> org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:141)
> at
> org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple (SingleTupleSinkAdapter.java:20)
> at org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:120)
> but when i replace "or" with "and" operator then it is working fine:
> import java.util.Map ;
> import com.IValidationField;
> rule "ValueAllowed_G10.3"
> when
> IValidationField(attributeId =="G10.3")
> $map : Map( keySet contains "ErrorMap" )
> eval($map.put("G10.3_V ","E_V_ALLOWED") == null || true)
> (and Map( this["G10.2"] not in("5"))
> Map( this["G10.2"] in("5")))
> then
> map.remove("G10.3_V");
> System.out.println ("comming
> here----------------------------------------->");
> end
> --
> View this message in context: http://www.nabble.com/Problem-in-using-or-operator-with-values-in-map.-tf4472442.html#a12752031
> 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
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list