[
https://jira.jboss.org/jira/browse/JBRULES-2057?page=com.atlassian.jira.p...
]
Mark Proctor commented on JBRULES-2057:
---------------------------------------
The equality check depends on the type of working memory. If it's identity, then it
needs the same object. Not sure I plan to change this behaviour.
Collection returned by StatefulKnowledgeSession.getObjects()
doesn't conform to standard collection behaviour
-------------------------------------------------------------------------------------------------------------
Key: JBRULES-2057
URL:
https://jira.jboss.org/jira/browse/JBRULES-2057
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 5.0.0.CR1
Reporter: Damon Horrell
Assignee: Mark Proctor
Attachments: drools-bug-tests.zip
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira