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

Neil Wallace (JIRA) jira-events at lists.jboss.org
Tue Jul 7 10:44:51 EDT 2009


CLONE -Collection returned by StatefulKnowledgeSession.getObjects() doesn't conform to standard collection behaviour
--------------------------------------------------------------------------------------------------------------------

                 Key: JBRULES-2185
                 URL: https://jira.jboss.org/jira/browse/JBRULES-2185
             Project: JBoss Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 5.0.0.CR1
            Reporter: Neil Wallace
            Assignee: Mark Proctor
             Fix For: 5.0.1.FINAL


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