Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 321699 - CDOViewImpl.getObject(CDOID, boolean) can return wrong object for temporary ID's
Summary: CDOViewImpl.getObject(CDOID, boolean) can return wrong object for temporary ID's
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Caspar D. CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-04 07:56 EDT by Caspar D. CLA
Modified: 2011-06-23 03:42 EDT (History)
1 user (show)

See Also:
stepper: review+


Attachments
Testcase (as a patch) (2.59 KB, patch)
2010-08-04 08:03 EDT, Caspar D. CLA
no flags Details | Diff
Patch including testcase (4.59 KB, patch)
2010-08-04 22:47 EDT, Caspar D. CLA
no flags Details | Diff
Patch v2 - ready to be committed (4.59 KB, patch)
2010-08-07 03:50 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 Caspar D. CLA 2010-08-04 07:56:07 EDT
The implementation uses two fields lastLookupID/lastLookupObject,
presumably to optimize lookup performance for repeated lookups of
the same object.

But the mistaken assumption here is that the ID will continue to refer
to the same object; this isn't necessarily the case, as the getObject
function may well have been called with a temporary ID, and such an ID
may, as a consequence of a commit and subsequent creation of new
objects, later designate a different object.

See testcase that I'll attach in a minute.
Comment 1 Caspar D. CLA 2010-08-04 08:03:22 EDT
Created attachment 175831 [details]
Testcase (as a patch)
Comment 2 Caspar D. CLA 2010-08-04 22:47:15 EDT
Created attachment 175901 [details]
Patch including testcase
Comment 3 Eike Stepper CLA 2010-08-07 03:50:42 EDT
Created attachment 176080 [details]
Patch v2 - ready to be committed

Caspar, you can clone this bug to maintenance and commit there without review.
Comment 4 Caspar D. CLA 2010-08-08 22:41:54 EDT
Committed to HEAD
Comment 5 Eike Stepper CLA 2011-06-23 03:42:12 EDT
Available in R20110608-1407