Bug 394076 - CDOResource.contents should resolve proxies :-)
Summary: CDOResource.contents should resolve proxies :-)
Status: NEW
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.13   Edit
Hardware: PC Mac OS X
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-12 05:11 EST by Christophe Bouhier CLA
Modified: 2020-12-11 10:38 EST (History)
0 users

See Also:


Attachments
test case (2.45 KB, application/text)
2013-02-26 06:33 EST, Christophe Bouhier CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Bouhier CLA 2012-11-12 05:11:03 EST
When I process a Resource, I sometimes convert the content, with a little piece of code like this: 

Code: [Select all] [Show/ hide]
public static class CollectionForObjects<T> {

		public List<T> collectionForObjects(List<EObject> objects) {
			
			List<T> typedList = Lists.transform(objects,
					new Function<EObject, T>() {

						@SuppressWarnings("unchecked")
						public T apply(EObject from) {
							return (T) from;
						}
					});

			return typedList;
		}

	}


This used to work fine in CDO 4.0, with 4.2 however I get this class cast exception below. 
So a CDOElementProxy, can't be cast to an EObject, what could I do with it to get a collection of 
target objects? What has changed? 


java.lang.ClassCastException: org.eclipse.emf.cdo.internal.common.revision.CDOElementProxyImpl cannot be cast to org.eclipse.emf.ecore.EObject
at com.netxforge.netxstudio.common.model.ModelUtils$CollectionForObjects$1.apply(ModelUtils.java:1)
at com.google.common.collect.Lists$TransformingSequentialList$1.next(Lists.java:381)
at com.netxforge.netxstudio.common.model.ModelUtils.roleForUserWithName(ModelUtils.java:1959)
at com.netxforge.netxstudio.data.DataService.getCurrentRole(DataService.java:71)
at com.netxforge.netxstudio.ui.ApplicationWorkbenchAdvisor.resetWorkbenchIfRoleChanged(ApplicationWorkbenchAdvisor.java:69)
Comment 1 Christophe Bouhier CLA 2013-02-26 06:33:56 EST
Created attachment 227595 [details]
test case

test case to reproduce the problem
Comment 2 Christophe Bouhier CLA 2013-02-26 06:36:30 EST
the test case doesn't fail. 

I re-enabled the collection loading policy in my application, and this also now works. 

The difference is the CDO integration build I am now using versus the one when the bug was reported. The build I am using (Not having this bug). 

emf-cdo-I20130201-0411-Dropins
Comment 3 Christophe Bouhier CLA 2013-02-26 06:37:22 EST
propose to close, advise to use recent CDO integration build with 4.2
Comment 4 Eike Stepper CLA 2013-06-29 12:19:45 EDT
We'll try to address open problems in 4.3 (master) first and then port fixes back to 4.2.
Comment 5 Eike Stepper CLA 2015-07-14 02:16:32 EDT
Moving all open bugzillas to 4.5.
Comment 6 Eike Stepper CLA 2016-07-31 00:59:30 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 7 Eike Stepper CLA 2017-12-28 01:19:30 EST
Moving all open bugs to 4.7
Comment 8 Eike Stepper CLA 2019-11-08 02:05:56 EST
Moving all unresolved issues to version 4.8-
Comment 9 Eike Stepper CLA 2019-12-13 12:54:03 EST
Moving all unresolved issues to version 4.9
Comment 10 Eike Stepper CLA 2020-12-11 10:38:34 EST
Moving to 4.13.