Hey,

 

I was cranking along writing rules when all of a sudden JUnit reported an
NPE (see below) during WorkingMemory.fireAllRules().  The rule referenced in
the stack trace is as follows,

 

rule "Add report periods to the FEQueryList"

      when

            tr : TimeRange(level == TimeRange.FE, durationInMillis > 0 )

            ctx : HashMap()

            eval(ctx.containsKey("FEQueryList"))

      then

            System.out.println("Adding FE period to the list");

            Vector v = (Vector)ctx.get("FEQueryList");

            HashMap m = new HashMap();

            v.add(m);

            m.put("st", new Long(tr.getStartTime()));

            m.put("et", new Long(tr.getEndTime()));

            m.put("relation", "PMI_FE");

            retract(tr);

end

 

The NPE occurs on the retract() on the last line of the consequence.

 

I'm not exactly sure what to do about it.  I suppose I could look at the
code.

 

Any suggestions?

 

Thanks.

-MItch

 

org.drools.spi.ConsequenceException: java.lang.NullPointerException

            at org.drools.common.Agenda.fireActivation(Agenda.java:327)

            at org.drools.common.Agenda.fireNextItem(Agenda.java:303)

            at
org.drools.reteoo.WorkingMemoryImpl.fireAllRules(WorkingMemoryImpl.java:248)

            at
org.drools.reteoo.WorkingMemoryImpl.fireAllRules(WorkingMemoryImpl.java:261)

            at
com.packetmotion.trinity.gsm.report.RuleEngineTest.testContextBuilderFe2Dail
y(RuleEngineTest.java:358)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)

            at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)

            at java.lang.reflect.Method.invoke(Method.java:324)

            at junit.framework.TestCase.runTest(TestCase.java:154)

            at junit.framework.TestCase.runBare(TestCase.java:127)

            at junit.framework.TestResult$1.protect(TestResult.java:106)

            at junit.framework.TestResult.runProtected(TestResult.java:124)

            at junit.framework.TestResult.run(TestResult.java:109)

            at junit.framework.TestCase.run(TestCase.java:118)

            at junit.framework.TestSuite.runTest(TestSuite.java:208)

            at junit.framework.TestSuite.run(TestSuite.java:203)

            at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:481)

            at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:347)

            at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:197)

Caused by: java.lang.NullPointerException

            at
org.drools.reteoo.beta.DefaultRightMemory.remove(DefaultRightMemory.java:64)

            at org.drools.reteoo.BetaMemory.remove(BetaMemory.java:150)

            at org.drools.reteoo.NotNode.retractObject(NotNode.java:178)

            at
org.drools.reteoo.ObjectSource.propagateRetractObject(ObjectSource.java:128)

            at
org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:152)

            at org.drools.reteoo.Rete.retractObject(Rete.java:153)

            at
org.drools.reteoo.RuleBaseImpl.retractObject(RuleBaseImpl.java:272)

            at
org.drools.reteoo.WorkingMemoryImpl.retractObject(WorkingMemoryImpl.java:601
)

            at
org.drools.base.DefaultKnowledgeHelper.retractObject(DefaultKnowledgeHelper.
java:87)

            at
com.packetmotion.trinity.sqlgen.ContextBuilder.Rule_Add_report_periods_to_th
e_FEQueryList_0.consequence(Rule_Add_report_periods_to_the_FEQueryList_0.jav
a:23)

            at
com.packetmotion.trinity.sqlgen.ContextBuilder.Rule_Add_report_periods_to_th
e_FEQueryList_0ConsequenceInvoker.evaluate(Rule_Add_report_periods_to_the_FE
QueryList_0ConsequenceInvoker.java:22)

            at org.drools.common.Agenda.fireActivation(Agenda.java:325)

            ... 19 more

 

Reply via email to