Bug 241252 - addListenersToContainers of CanonicalEditPolicy wrongly uses toString method to generate IDs
Summary: addListenersToContainers of CanonicalEditPolicy wrongly uses toString method ...
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 normal
Target Milestone: 2.1.2   Edit
Assignee: Marc Gobeil CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-07-17 10:01 EDT by Anthony Hunter CLA
Modified: 2010-07-19 21:58 EDT (History)
3 users (show)

See Also:


Attachments
requested fix (1.18 KB, patch)
2008-08-29 15:25 EDT, Marc Gobeil CLA
ahunter.eclipse: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Hunter CLA 2008-07-17 10:01:42 EDT
From Gleb:

CanonicalEditPolicy wrongly relies on the particular implementation of View#toString method to generate IDs in the addListenersToContainers method.
It should use hashCode method instead: addListenerFilter("NotationListener_Container" + containerView.hashCode().toString() instead of addListenerFilter("NotationListener_Container" + containerView.toString().

We override View#toString method with a Debug-friendlier implementation and this causes problems for us.
Comment 1 Anthony Hunter CLA 2008-07-18 17:29:50 EDT
containerView.hashCode().toString()

ERROR: cannot invoke toString() on a primitive type int

So cannot fix as suggested.
Comment 2 Gleb Sturov CLA 2008-07-21 09:44:23 EDT
The correct code probably would be something like:
String.valueOf(containerView.hashCode())
Comment 3 Anthony Hunter CLA 2008-08-07 16:10:58 EDT
Hi Marc,

Can you verify the requested change for me?

Comment 4 Marc Gobeil CLA 2008-08-29 15:25:54 EDT
Created attachment 111327 [details]
requested fix

This replaces the call to toString() with the implementation of toString(), so it can be overridden without affecting the listener list.
Comment 5 Alex Boyko CLA 2008-09-03 11:29:41 EDT
Committed the fix for 2.1.2 and 2.2

[241252] gmf_head mgobeil 080903 addListenersToContainers of CanonicalEditPolicy wrongly uses toString method to generate IDs

[241252] gmf_R2_1_maintenance mgobeil 080903 addListenersToContainers of CanonicalEditPolicy wrongly uses toString method to generate IDs
Comment 6 Eclipse Webmaster CLA 2010-07-19 21:58:05 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime was the original product and component for this bug