[
http://jira.jboss.com/jira/browse/JBRULES-506?page=comments#action_12344980 ]
Michael Neale commented on JBRULES-506:
---------------------------------------
OK, its wierd, I see three retracts (3rd attempt fails as activation is null). There
should only be one, as no-loop should prevent any further activations on rule1.
In the meantime, can you use modify? Not sure why you would want to retract and assert
manually.
Exception thrown when retract, reassert and retract again
---------------------------------------------------------
Key: JBRULES-506
URL:
http://jira.jboss.com/jira/browse/JBRULES-506
Project: JBoss Rules
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 3.0.1, 3.0.4
Reporter: Leo Liang
Assigned To: Mark Proctor
Attachments: Fact.java, test.drl, TestDriver.java
In one rule retract the object and re-assert it, then retract the object again in the
following activated rule. A null pointer exception will occur at this time.
java.lang.NullPointerException
at org.drools.reteoo.TerminalNode.retractTuple(TerminalNode.java:216)
at org.drools.reteoo.LeftInputAdapterNode.retractObject(LeftInputAdapterNode.java:207)
at org.drools.reteoo.ObjectSource.propagateRetractObject(ObjectSource.java:141)
at org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:180)
at org.drools.reteoo.Rete.retractObject(Rete.java:150)
at org.drools.reteoo.ReteooRuleBase.retractObject(ReteooRuleBase.java:207)
at org.drools.reteoo.ReteooWorkingMemory.doRetract(ReteooWorkingMemory.java:77)
at
org.drools.common.AbstractWorkingMemory.retractObject(AbstractWorkingMemory.java:668)
at org.drools.base.DefaultKnowledgeHelper.retractObject(DefaultKnowledgeHelper.java:86)
at com.ericsson.ruletest.debug.Rule_test2_0.consequence(Rule_test2_0.java:8)
at
com.ericsson.ruletest.debug.Rule_test2_0ConsequenceInvoker.evaluate(Rule_test2_0ConsequenceInvoker.java:22)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:437)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:407)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:269)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:256)
at com.ericsson.ruletest.TestDriver.main(TestDriver.java:26)
The given test case is the the simplified from my production code.
--------------- test.drl ------------------------
package com.ericsson.ruletest.debug
import com.ericsson.ruletest.Fact;
rule "test1"
salience 10
no-loop true
when
input:Fact();
then
retract(input);
assert(input);
end;
rule "test2"
salience 0
no-loop true
when
input:Fact();
then
retract(input);
end;
--
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