Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342603 - Use of SetCommand with List lead to a wrong result
Summary: Use of SetCommand with List lead to a wrong result
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Edit (show other bugs)
Version: 2.7.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 337408
  Show dependency tree
 
Reported: 2011-04-12 12:02 EDT by Nicolas Guyomar CLA
Modified: 2011-05-10 11:57 EDT (History)
0 users

See Also:


Attachments
Junit Test plugin to reproduce the bug (8.94 KB, application/x-zip-compressed)
2011-04-12 12:02 EDT, Nicolas Guyomar CLA
no flags Details
Patches to address the issue. (2.58 KB, patch)
2011-04-12 13:11 EDT, Ed Merks CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Guyomar CLA 2011-04-12 12:02:28 EDT
Created attachment 193062 [details]
Junit Test plugin to reproduce the bug

Hi,

While using EMF Command, I wanted to sort a list of elements before using a SetCommand to set the resulting list to an EObject. 

The sort result is ok, but during the SetCommand something goes wrong and the following happens : 

- the elements which where already in the "correct" sorted position (before the sort) are not accurately placed after the command execution.

I think it has something to do with the use of MoveCommand in the implementation of SetCommand, because this bug only happens if I create the SetCommand using SetCommand.create(...) and not with a "usual" instanciation "new SetCommand()"

Because I do not really know how to express this bug in a better way, I reproduced both instantiation scenarios using an UML Class and some properties in the attached JUnit plug-in test.

Regards,
Nicolas Guyomar

http://www.eclipse.org/modeling/emft/facet/
http://www.eclipse.org/MoDisco/
Comment 1 Ed Merks CLA 2011-04-12 13:11:55 EDT
Created attachment 193076 [details]
Patches to address the issue.

It looks like it's important to keep the list of remainingValues that we're using to analyze which objects need to be moved in sync with the moves that will be done by the actual move commands.  Could you verify this solves the problem; it makes the test pass. 

Thanks for making it so easy to reproduce the problem!
Comment 2 Nicolas Guyomar CLA 2011-04-13 03:17:24 EDT
Hi Ed,

Thank you for the patch, it solves my problem with the SetCommand.

Would that patch be applied for 3.6 M7 ?

Regards,
Nicolas Guyomar
Comment 3 Ed Merks CLA 2011-04-13 11:11:27 EDT
The fix is committed to CVS for 2.7.  It will be in the M7 build.
Comment 4 Ed Merks CLA 2011-05-10 11:57:51 EDT
The changes are available in EMF 2.7 M7 or an earlier build.