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

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-03-27 20:07:35 UTC
Type: Bug
Embargoed:


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)
ksession.update(handle,object);

you will receive NPE

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


How reproducible:
always

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
https://github.com/droolsjbpm/drools/blob/master/knowledge-api-legacy5-adapter/src/main/java/org/drools/impl/adapters/WorkingMemoryEntryPointAdapter.java#L47

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.