Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314519 - CDOView.getObject(T) causes ClassCastException with legacy objects
Summary: CDOView.getObject(T) causes ClassCastException with legacy objects
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.legacy (show other bugs)
Version: 3.0   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: 2010-05-26 12:53 EDT by Eike Stepper CLA
Modified: 2012-06-19 07:08 EDT (History)
1 user (show)

See Also:


Attachments
Patch (2.67 KB, patch)
2010-05-26 12:59 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 Eike Stepper CLA 2010-05-26 12:53:51 EDT
The return value should go through CDOUtil.getEObject() because CDOLegacyAdapter can not be cast to T normally.
Comment 1 Eike Stepper CLA 2010-05-26 12:59:10 EDT
Created attachment 170052 [details]
Patch

For future reference
Comment 2 Eike Stepper CLA 2010-05-26 13:00:11 EDT
Changed to:

      CDOID id = object.cdoID();
      InternalCDOObject contextified = getObject(id, true);

      @SuppressWarnings("unchecked")
      T cast = (T)CDOUtil.getEObject(contextified);
      return cast;
Comment 3 Eike Stepper CLA 2010-06-29 04:36:30 EDT
Available in 3.0 GA:
http://download.eclipse.org/modeling/emf/cdo/updates/3.0-releases/