Hello all,

I have an application that was written originally using Drools 5.3.1.Final that works just fine.  I wrote a JUnit test that runs through values contained in a spreadsheet.  Everything was working great.  I updated the application to use Drools 5.4.0.Final and then the test stopped working.  I have debugged the code and here is the exception thrown:

Exception executing consequence for rule "create vcmax" in org.zoikks.drools: java.lang.NullPointerException
at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1283)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1209)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1442)
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 org.zoikks.drools.xlsx.SampleWorkflowXlsx.check(SampleWorkflowXlsx.java:103)
at org.zoikks.drools.xlsx.SampleWorkflowXlsx.testSampleXlsxSheets(SampleWorkflowXlsx.java:77)
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:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
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 ConditionEvaluator0f64b1c63942476d80eb29d1cdffda28.evaluate(Unknown Source)
at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:167)
at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:124)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:337)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:888)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:187)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:181)
at org.zoikks.drools.Rule_create_vcmax_692832fd6e0547e09b6f632175df45ff.defaultConsequence(Rule_create_vcmax_692832fd6e0547e09b6f632175df45ff.java:7)
at org.zoikks.drools.Rule_create_vcmax_692832fd6e0547e09b6f632175df45ffDefaultConsequenceInvokerGenerated.evaluate(Unknown Source)
at org.zoikks.drools.Rule_create_vcmax_692832fd6e0547e09b6f632175df45ffDefaultConsequenceInvoker.evaluate(Unknown Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1273)
... 26 more

This appears to be a race-condition occurring someplace within the app because it executes find some times, yet other times a NPE is thrown.  The location where the exception is originating is new to Drools 5.4.0.Final so there is nothing to compare against in previous versions.  Has anyone else seen this and/or does anyone know how to solve this problem?

I have attached code that is using Drools 5.4.0.Final.  To successfully re-produce the problem, place a breakpoint at org.drools.rule.constraint.MvelConstraint.evaluate() [Line 167] and then step through.  The exception has been occurring continuously.

Thanks,

- Darin