Community
Participate
Working Groups
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.14) Gecko/2009090216 Firefox/3.0.1 Build Identifier: CDO 2.0.0.v200906160459 It seems reasonable for an app to assume that it can safely check whether an object is still connected to the graph by checking eResource() != null. And indeed this works fine for objects that were disconnected locally (and hence are TRANSIENT). But when eResource() is called on a CDOObjectImpl in state INVALID (i.e. detached remotely), an InvalidObjectException is thrown. I think it doesn't quite make sense for eResource() to behave differently for objects that were detached remotely than for objects that were detached locally. The caller just wants to know if the object is still connected or not, and so is probably best served by receiving null in the case of an INVALID object, same as for a TRANSIENT object. Note that it's not just application code that assumes eResource() is safe to call. The "higher-level" parts of EMF, such as validation, assume this too. For these EMF tools to work with CDOObjects (which, AFAIAC is highly desirable ;-)) would require eResource to return null for INVALID objects. Reproducible: Always
Created attachment 149951 [details] Patch for 2.0.0 This patch adds an override for BasicEObjectImpl.eInternalResource to preempt the base implementation's handling of INVALID CDOobjects. Amending CDOObjectImpl.eDirectResource was insufficient because then eInternalResource starts a walk up the container hierarchy, which causes a read op on the INVALID object, which also gives an exception.
It seems as if this patch got out of sync ;-( Can you please re-integrate it?
Created attachment 151525 [details] Patch for 2.0.1 As requested, uploading a patch generated relative to the current (Nov-6) codebase in R2_0_maintenance.
Committed to R2_0_maintenance
Comment on attachment 151525 [details] Patch for 2.0.1 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.
(In reply to comment #5) > (From update of attachment 151525 [details]) > 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. I confirm.
Available in 2.0.2: https://build.eclipse.org/hudson/job/emf-cdo-maintenance/44/artifact/result/site.p2/