FYI I have created JBRULES-3632 and attached minimalistic maven project
that reproduces this issue.
On Tue, Sep 11, 2012 at 12:42 PM, Michal Bali <michalbali(a)gmail.com> wrote:
Hi all,
I am upgrading an application from 5.3.0.Final to 5.4.0.Final and I am
getting the following exception:
Exception executing consequence for rule "ruleThatFails" in
indexingproblem.remove.me.anditworks:
java.lang.UnsupportedOperationException
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1212)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1446)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)
at com.mycompany.app.IndexingProblemMain.main(IndexingProblemMain.java:36)
Caused by: java.lang.UnsupportedOperationException
at org.drools.reteoo.BaseLeftTuple.getPrevious(BaseLeftTuple.java:480)
at org.drools.core.util.index.LeftTupleList.remove(LeftTupleList.java:114)
at
org.drools.core.util.index.LeftTupleList.removeAdd(LeftTupleList.java:68)
at org.drools.reteoo.JoinNode.modifyLeftTuple(JoinNode.java:310)
at
org.drools.reteoo.LeftTupleSource.doModifyLeftTuple(LeftTupleSource.java:304)
at
org.drools.reteoo.LeftTupleSource.modifyLeftTuple(LeftTupleSource.java:278)
at org.drools.reteoo.JoinNode.modifyLeftTuple(JoinNode.java:437)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateModifyLeftTuple(SingleLeftTupleSinkAdapter.java:205)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyObject(SingleLeftTupleSinkAdapter.java:235)
at
org.drools.reteoo.LeftInputAdapterNode.modifyObject(LeftInputAdapterNode.java:170)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateModifyObject(SingleObjectSinkAdapter.java:68)
at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:157)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:507)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:421)
at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:314)
at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:265)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:483)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:383)
at
org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:337)
at
indexingproblem.remove.me.anditworks.Rule_ruleThatFails_b159773c7b1a41a2a93044d2816b96ca.defaultConsequence(Rule_ruleThatFails_b159773c7b1a41a2a93044d2816b96ca.java:9)
at
indexingproblem.remove.me.anditworks.Rule_ruleThatFails_b159773c7b1a41a2a93044d2816b96caDefaultConsequenceInvokerGenerated.evaluate(Unknown
Source)
at
indexingproblem.remove.me.anditworks.Rule_ruleThatFails_b159773c7b1a41a2a93044d2816b96caDefaultConsequenceInvoker.evaluate(Unknown
Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1277)
... 6 more
I have tried to create a minimal test case that recreates this issue, here
it is:
package indexingproblem.remove.me.anditworks;
declare Criteria
processed : boolean
end
declare CheeseCriteria extends Criteria
end
rule setUp
salience 10000
when
then
insert(new CheeseCriteria());
end
rule aaa
when
CheeseCriteria( )
then
end
rule bbb
when
CheeseCriteria( )
then
end
rule ccc
when
CheeseCriteria( )
then
end
rule eeeFalse
when
Criteria( processed == false )
then
end
declare Filter
end
rule fffTrue
when
Criteria( processed == true )
Filter( )
then
end
rule ruleThatFails
when
$criteria : Criteria( processed == false )
then
modify($criteria) {
setProcessed(true)
}
end
I've tried to run it on 5.5.0-SNAPSHOT, but I got the same result. Note
that if you change the rule package to be "package indexingproblem" the
exception is not thrown. The code for building the KnowledgeBase is
standard, I haven't used any additional options. No fact is inserted only
one fireAllRules call.
Please let me know if I should create a new JIRA ticket for this or if I
am doing something wrong.
Thanking you in advance.
Best regards,
Michal