Bug 1119731 - Missing null check in legacy api causing nullpointerexception
Summary: Missing null check in legacy api causing nullpointerexception
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
Target Milestone: DR2
: 6.1.0
Assignee: Mario Fusco
QA Contact: Marek Winkler
Depends On:
TreeView+ depends on / blocked
Reported: 2014-07-15 11:51 UTC by Anton Giertli
Modified: 2018-12-06 17:20 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed:
Type: Bug

Attachments (Terms of Use)
[0] reproducer (5.42 KB, application/zip)
2014-07-15 11:51 UTC, Anton Giertli
no flags Details

Description Anton Giertli 2014-07-15 11:51:20 UTC
Created attachment 918147 [details]
[0] reproducer

Description of problem:

If you try to retrieve FactHandle for an object which is **not** present in the KnowledgeSession this fact handle will not have null value.

There, if you call

if (handle!=null)

you will receive NPE

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

How reproducible:

Steps to Reproduce:
1. Just execute the reproducer with the Drools 6 libraries - i.e. knowledge-api legacy adapter

Actual results:

	FactHandle handle = ksession.getFactHandle(msg1);

handle is not null even if the msg1 object is NOT present in the session.

Expected results:
	FactHandle handle = ksession.getFactHandle(msg1);

handle should be null if the msg1 object is not present in the session

Additional info:

Root cause seems to be the missing nullcheck in the following method

Comment 2 Mario Fusco 2014-07-15 15:14:53 UTC
Fixed by https://github.com/droolsjbpm/drools/commit/386dce144

Comment 3 Marek Winkler 2014-09-29 10:58:05 UTC
Verified with BRMS 6.1.0.DR3.

Note You need to log in before you can comment on or make changes to this bug.