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

Bug 318844

Summary: CDONotificationBuilder cannot handle mixed OID's/CDOObjects when processing CDOClearFeatureDelta
Product: [Modeling] EMF Reporter: Caspar D. <caspar_d>
Component: cdo.coreAssignee: Eike Stepper <stepper>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 CC: saulius.tvarijonas
Version: 3.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Testcase (as a patch)
none
Fix and Test v1 none

Description Caspar D. CLA 2010-07-05 04:46:21 EDT
Code assumes that list consists either of CDOID's only, or
of CDOObjects only. But the list content can in fact be mixed.
When it is, a ClassCastException gets thrown because the
subsequent iteration over the list's contents assumes all
elements are CDOID's.

Offending code is in CDONotificationBuilder.java, lines 180 ff.
Comment 1 Caspar D. CLA 2010-07-05 04:59:23 EDT
Created attachment 173394 [details]
Testcase (as a patch)

Testcase demonstrates how the problem can occur during refresh,
if the list being clear locally had a new element that had not 
been committed yet.
Comment 2 Eike Stepper CLA 2010-07-05 05:00:12 EDT
I have a fix in mind...
Comment 3 Caspar D. CLA 2010-07-05 05:10:03 EDT
I'm thinking there may be a deeper problem here. It seems a
CDOClearFeatureDelta is generated if the incoming update removes
all *persisted* elements of the list. So the mistake, as I see it,
is that the delta is generated from a comparison between the new
revision (from the server) and the revision that was originally
viewed in the client -- but actually it should be between the 
new revision and the lists's *current* value (which may contain
new, unpersisted elements).
Comment 4 Eike Stepper CLA 2010-07-05 05:13:50 EDT
Created attachment 173397 [details]
Fix and Test v1
Comment 5 Eike Stepper CLA 2010-07-05 05:25:34 EDT
Committed to R3_0_maintenance
Comment 6 Eike Stepper CLA 2011-06-23 04:27:20 EDT
Moving all open problem reports to 4.0
Comment 7 Eike Stepper CLA 2012-09-21 06:36:54 EDT
Undoing accidental version change.
Comment 8 Eike Stepper CLA 2012-09-21 06:50:49 EDT
Closing.