Bug 1049367

Summary: RETE-OO: NPE when using queries
Product: [Retired] JBoss BRMS Platform 6 Reporter: Marek Winkler <mwinkler>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED CURRENTRELEASE QA Contact: Marek Winkler <mwinkler>
Severity: urgent Docs Contact:
Priority: high    
Version: 6.0.0   
Target Milestone: CR1   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:18:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Maven project with reproducer none

Description Marek Winkler 2014-01-07 13:33:52 UTC
Description of problem:

When evaluating a query with forall, such as

query ifAllPersonsAreOlderReturnThem (int pAge)
    forall ( Person(age > pAge) )
    $person : Person()
end

the following NPE is thrown:

java.lang.NullPointerException
	at org.drools.core.util.LinkedList.add(LinkedList.java:113)
	at org.drools.core.phreak.SegmentUtilities.createSegmentMemory(SegmentUtilities.java:145)
	at org.drools.core.phreak.SegmentUtilities.createChildSegment(SegmentUtilities.java:331)
	at org.drools.core.phreak.SegmentUtilities.createChildSegments(SegmentUtilities.java:323)
	at org.drools.core.reteoo.LeftInputAdapterNode.doInsertObject(LeftInputAdapterNode.java:215)
	at org.drools.core.common.AbstractWorkingMemory.evalQuery(AbstractWorkingMemory.java:552)
	at org.drools.core.common.AbstractWorkingMemory.getQueryResults(AbstractWorkingMemory.java:446)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.getQueryResults(StatefulKnowledgeSessionImpl.java:816)

Version-Release number of selected component (if applicable):

BRMS 6.0.0 ER7

How reproducible:

Please run QueryTest from the attached maven project with reproducer:

mvn clean test -Dtest=QueryTest -Ddrools.ruleEngine=reteoo

The test passes with phreak.

Actual results:

A NPE is thrown.

Expected results:

The test passes.
Additional info:

Comment 1 Marek Winkler 2014-01-07 13:40:33 UTC
Created attachment 846665 [details]
Maven project with reproducer

Comment 2 Mario Fusco 2014-01-08 11:51:46 UTC
Fixed by https://github.com/droolsjbpm/drools/commit/dacb3774f

Comment 3 Marek Winkler 2014-01-23 17:41:02 UTC
Verified on BRMS 6.0.0 CR1.