[CDO] 4.2 and CDOElementProxy [message #968352] |
Fri, 02 November 2012 07:53  |
Eclipse User |
|
|
|
Hi,
When I process a Resource, I sometimes convert the content, with a little piece of code like this:
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? I mean, is there a bug describing this? +
Thanks/
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)
|
|
|
Re: [CDO] 4.2 and CDOElementProxy [message #968495 is a reply to message #968352] |
Fri, 02 November 2012 09:53   |
Eclipse User |
|
|
|
Am 02.11.2012 12:53, schrieb Christophe Bouhier:
> Hi,
> When I process a Resource, I sometimes convert the content, with a little piece of code like this:
> 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? I mean, is
> there a bug describing this? +
Are you using partial collection loading explicietely, i.e., session.options().setCollectionLoadingPolicy(...) ?
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
> Thanks/
>
> 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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: [CDO] 4.2 and CDOElementProxy [message #1014723 is a reply to message #1014720] |
Tue, 26 February 2013 05:48  |
Eclipse User |
|
|
|
Am 26.02.2013 11:44, schrieb Christophe Bouhier:
> On 26-02-13 10:42, Eike Stepper wrote:
>> Am 26.02.2013 09:52, schrieb Christophe Bouhier:
>>> On 26-02-13 07:25, Eike Stepper wrote:
>>>> A quick scan of our open bugzillas
>>>
>>> Removing this line of code solved the issue for me:
>>>
>>> cdoSession.options().setCollectionLoadingPolicy(
>>> CDOUtil.createCollectionLoadingPolicy(0, 300));
>> Oh boy! Let me cite your second post in this thread: "No I am not
>> explicitly setting a collection loading policy."
>>
> I think I corrected that statement in the thread :P
Okay, okay. I apologize ;-)
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
> ********
>
> Oh.... bummer. My initial search didn't reveal this line of code:
>
> cdoSession.options().setCollectionLoadingPolicy(
> CDOUtil.createCollectionLoadingPolicy(0, 300));
>
>
> So, yes I do set a loading policy.
> / Christophe
>
>
>>>
>>>
>>> What is wrong with this bug BTW? Why create another one?
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=394076
>> Probably nothing. I just scanned for "proxy" :P
>>
> Ok, working on a test case without Guava.
>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.21055 seconds