Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354395 - containsAll returns wrong result in case of detached objects
Summary: containsAll returns wrong result in case of detached objects
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-10 11:22 EDT by Stefan Schedl CLA
Modified: 2012-09-21 07:18 EDT (History)
0 users

See Also:


Attachments
JUnit-Test (2.94 KB, text/x-java)
2011-08-10 11:24 EDT, Stefan Schedl CLA
no flags Details
Fix (10.43 KB, patch)
2011-08-10 12:44 EDT, Eike Stepper CLA
no flags Details | Diff
Add-on fix (incremental) (1.56 KB, patch)
2011-08-10 13:25 EDT, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Schedl CLA 2011-08-10 11:22:52 EDT
Build Identifier:  20110615-0604

[17:20:17 | Bearbeitet 17:20:27] Bernd: If an ereference feature contains a detached object (e.g. if a contained object was removed from its containment relationship), then the call of containsAll() will return false instead of true. I attached a junit test which demonstrates this problem. I also see this problem with contains(), but I was not able to reproduce this in an unit-test. 
I think the problem could be in org.eclipse.emf.internal.cdo.view.CDOStoreImpl.contains() where the CDOID of the object will be used for check the containment in the CDORevision values, but in the case of a detached object, the objected itself will be hold in the CDORevision not only its id.

Reproducible: Always

Steps to Reproduce:
1. see unit-test
2.
3.
Comment 1 Stefan Schedl CLA 2011-08-10 11:24:41 EDT
Created attachment 201251 [details]
JUnit-Test
Comment 2 Eike Stepper CLA 2011-08-10 12:43:50 EDT
Thanks for the good test case. I'll fix this in 4.1 first and backport to maintenance later.
Comment 3 Eike Stepper CLA 2011-08-10 12:44:10 EDT
Created attachment 201256 [details]
Fix
Comment 4 Eike Stepper CLA 2011-08-10 12:45:03 EDT
Stefan, for the contributed test case, please confirm that:

1) The number of lines that you changed is smaller than 250.
2) You are the only author of these changed lines.
3) You apply the EPL to these changed lines.
Comment 5 Eike Stepper CLA 2011-08-10 12:45:53 EDT
Committed revision 8893
Comment 6 Eike Stepper CLA 2011-08-10 12:46:40 EDT
Backport to 4.0 in bug 354412.
Comment 7 Stefan Schedl CLA 2011-08-10 13:05:35 EDT
Hi,

I confirm that 
 The number of lines that I changed is smaller than 250.
 I'm  the only author of these changed lines.
 I apply the EPL to these changed lines.

and thank you for the fast fix.
Comment 8 Eike Stepper CLA 2011-08-10 13:25:25 EDT
Created attachment 201258 [details]
Add-on fix (incremental)

Fixes 3 test failures in legacy mode.
Comment 9 Eike Stepper CLA 2012-09-21 07:18:21 EDT
Closing.