Details
-
Bug
-
Resolution: Done
-
Major
-
5.5.0.Final
-
None
-
None
Description
NPE : unit test which depends only on 3 non Drools simple classes : Assignment, Triple, TripleUser
unit test has 2 rules , 5 inserts, 3 fireAllRules : the last one makes the NPE.
TestDroolsNPE.testRunRulesBefore
testRunRulesBefore(eulergui.project.TestDroolsNPE)
Exception executing consequence for rule "project-java-rules2.n3 0" in project_java_rules2_n3_1: java.lang.NullPointerException
at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1297)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1221)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1456)
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 eulergui.project.TestDroolsNPE.testRunRulesBefore(TestDroolsNPE.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:196)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
at org.drools.base.DefaultKnowledgeHelper.insertLogical(DefaultKnowledgeHelper.java:245)
at org.drools.base.DefaultKnowledgeHelper.insertLogical(DefaultKnowledgeHelper.java:210)
at org.drools.base.DefaultKnowledgeHelper.insertLogical(DefaultKnowledgeHelper.java:205)
at project_java_rules2_n3_1.Rule_project_java_rules2_n3_0_dd5596b676034b1fb5b32877015997e3.defaultConsequence(Rule_project_java_rules2_n3_0_dd5596b676034b1fb5b32877015997e3.java:12)
at project_java_rules2_n3_1.Rule_project_java_rules2_n3_0_dd5596b676034b1fb5b32877015997e3DefaultConsequenceInvokerGenerated.evaluate(Unknown Source)
at project_java_rules2_n3_1.Rule_project_java_rules2_n3_0_dd5596b676034b1fb5b32877015997e3DefaultConsequenceInvoker.evaluate(Unknown Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287)
... 25 more
in class NamedEntryPoint :
protected FactHandle insert(final Object object,
final Object tmsValue,
final boolean dynamic,
boolean logical,
final Rule rule,
final Activation activation) throws FactException {
if ( object == null )
try {
this.wm.startOperation();
ObjectTypeConf typeConf = this.typeConfReg.getObjectTypeConf( this.entryPoint,
object );
if ( logical && !typeConf.isTMSEnabled())
InternalFactHandle handle = null;
if ( this.wm.isSequential() )
{ handle = createHandle( object, typeConf ); insert( handle, object, rule, activation, typeConf ); return handle; } try {
this.lock.lock();
this.ruleBase.readLock();
// check if the object already exists in the WM
handle = this.objectStore.getHandleForObject( object );
if ( typeConf.isTMSEnabled() ) {
EqualityKey key;
TruthMaintenanceSystem tms = wm.getTruthMaintenanceSystem();
if ( handle == null )
else {
// Object is already asserted, so check and possibly correct its
// status and then return the handle
key = handle.getEqualityKey();
if ( key.getStatus() == EqualityKey.STATED ) {
// key == null here !!!!!!!!!!!!!!!!!!!
// conf.setAssertBehaviour( AssertBehaviour.EQUALITY );
when rule inserts Triple :
<file:/home/jmv/src/eulergui-code/eulergui/test/import.n3p.n3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Ontology> .
that is already present, as a TripleUser extends Triple, but equals() and hashCode() are the same ;
this object is both asserted and inferred as a Triple object