From: SourceForge.net <no...@so...> - 2006-06-05 20:23:57
|
Bugs item #1501213, was opened at 2006-06-05 22:23 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=391879&aid=1501213&group_id=27895 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: In-Memory Impl Group: CVS Status: Open Resolution: None Priority: 5 Submitted By: Xuan Baldauf (mediumnet) Assigned to: Nobody/Anonymous (nobody) Summary: MemberImpl.hashCode() is not consistent with equals() Initial Comment: When the constructor org.tm4j.topicmap.memory.MemberImpl( AssociationImpl parent, String id, Locator resourceLoc, Topic roleSpec, Collection players) is used, the to-be-constructed MemberImpl adds itself to each m_rolesPlayed field of every TopicImpl of the players collection. This field is a HashSet, and thus, hashCode() of the MemberImpl object is called. The method hashCode() (defined in org.tm4j.topicmap.memory.TopicMapObjectImpl) itself depends on the id of the MemberImpl object. However, the id is currently set ("setID(id);") _after_ the to-be-constructed MemberImpl adds itself to each m_rolesPlayed field of every TopicImpl of the players collection. Thus, hashCode() returns different values at different times (with a very high probability). In particular, hashCode() returns a different value before the call to setID(id) than after the call to setID(id). This, in turn, makes the call "m_rolesPlayed.contains(member)" in org.tm4j.topicmap.memory.TopicImpl.removeRolePlayed(Member member) return false, while it should return true. >From this on, the topic map data structure is inconsistent (and messed up). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=391879&aid=1501213&group_id=27895 |