[jboss-jira] [JBoss JIRA] Created: (JBRULES-2057) Collection returned by StatefulKnowledgeSession.getObjects() doesn't conform to standard collection behaviour

Damon Horrell (JIRA) jira-events at lists.jboss.org
Mon Apr 13 23:44:22 EDT 2009


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


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

        



More information about the jboss-jira mailing list