Bug 724228 (BRMS-172) - Collection returned by StatefulKnowledgeSession.getObjects() doesn't conform to standard collection behaviour
Summary: Collection returned by StatefulKnowledgeSession.getObjects() doesn't conform ...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: BRMS-172
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: unspecified
Version: unspecified
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: ---
: 5.0.1
Assignee: Mark Proctor
QA Contact:
URL: http://jira.jboss.org/jira/browse/BRM...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-07-07 14:44 UTC by nwallace
Modified: 2009-10-04 09:46 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-01 12:25:14 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker BRMS-172 0 None None None Never

Description nwallace 2009-07-07 14:44:27 UTC
Date of First Response: 2009-10-04 05:46:53
securitylevel_name: Public

StatefulKnowledgeSession.getObjects() returns a collection containing the objects in working memory.

The Javadoc for Collection.contains says:

"Returns true if this collection contains the specified element. More formally, returns true if and only if this collection contains at least one element e such that (o==null ? e==null : o.equals(e)). "

This is not the case though for StatefulKnowledgeSessionImpl.ObjectStoreWrapper.  The implementation of contains returns true only if it is the exact same object instance, but false if it is a different instance but which equals the instance in the working memory.

A workaround is to create a new collection and put the items returned into that.

Comment 1 nwallace 2009-07-07 14:45:42 UTC
Link: Added: This issue is related to JBRULES-2057


Comment 2 nwallace 2009-09-01 12:25:14 UTC
Fix in place.

Comment 3 Dana Mison 2009-10-04 09:46:53 UTC
added to the 5.0.CP01 release notes as resolved:

JBRULES-2057
StatefulKnowledgeSession.getObjects() returns a Collection whose contains method that does not conform to the expected Java Collection behaviour.   This is intentional and has now been documented in the API JavaDocs.


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