5.3.0 Final.<div><br><div>KnowledgeBase using STREAM, running a stateful session in one thread, inserting events from another fact.</div><div><br></div><div>class Event{ String name; }</div><div>class Monitor{ Event event; String name; }</div>
<div><br></div><div>rule "start monitoring"</div><div>when</div><div> $e: Event($name: name)</div><div> not Monitor( name == $name )</div><div>then</div><div> insert( new Monitor( $e, $name ) );</div><div>
end</div><div><br></div><div>rule "timeout"</div><div>timer( int: 10s )</div><div>when</div><div> $m: Monitor( name == $name )</div><div> $e: Event($name: name)</div><div>then</div><div> retract( $m ); // =======================</div>
<div> retract( $m.getEvent() ); // ========================</div><div>end</div><div><br></div><div>This order of retracts results in a NPE, see the dump below.</div><div><br></div><div>Reversing these two works correctly.</div>
<div><br></div><div><div>Exception in thread "main" Exception executing consequence for rule "start monitoring" in hashcode: java.lang.NullPointerException</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1229)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:753)</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:729)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:234)</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>at hashcode.Main.execute(Main.java:148)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at hashcode.Main.main(Main.java:206)</div><div>
Caused by: java.lang.NullPointerException</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.base.hashcode.StateEvent42211789$getItemName.getValue(Unknown Source)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.base.ClassFieldReader.getValue(ClassFieldReader.java:87)</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.rule.Declaration.getValue(Declaration.java:219)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at hashcode.Rule_start_monitoringDefaultConsequenceInvoker.evaluate(Unknown Source)</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>... 7 more</div>
</div><div><br></div></div>