Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321699

Summary: CDOViewImpl.getObject(CDOID, boolean) can return wrong object for temporary ID's
Product: [Modeling] EMF Reporter: Caspar D. <caspar_d>
Component: cdo.coreAssignee: Caspar D. <caspar_d>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 CC: saulius.tvarijonas
Version: 4.0Flags: stepper: review+
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Testcase (as a patch)
none
Patch including testcase
none
Patch v2 - ready to be committed none

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