Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] ClassCastException in CDODeltaNotification for Enum-based attribute
[CDO] ClassCastException in CDODeltaNotification for Enum-based attribute [message #1464447] Fri, 07 November 2014 15:13 Go to next message
Stephane  Fournier is currently offline Stephane FournierFriend
Messages: 299
Registered: July 2009
Senior Member
Hi,
Assume I have 2 clients (A and B) connected to a repository (MemStore).

A commits a change on attribute named "state" that is an Enum.

B receives a CDODeltaNotificationImpl with the change made on the attribute named "state". But there is a bug here, indeed both calling getOldObject / getNewObject returns an Integer instead of the Enum, I suppose it is due to the fact the Enum is transported over the networlk as integer.

Thus if I cast the result of getOldObject or getNewObject in the expected Enum, I get a ClassCastException.

I'm using CDO 4.3 release with Luna (Shipped in last June).
Should I file a bugzilla ?

St├ęphane.
Re: [CDO] ClassCastException in CDODeltaNotification for Enum-based attribute [message #1471415 is a reply to message #1464447] Thu, 13 November 2014 04:17 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6433
Registered: July 2009
Senior Member
Am 07.11.2014 um 16:13 schrieb Stephane Fournier:
> Hi,
> Assume I have 2 clients (A and B) connected to a repository (MemStore).
>
> A commits a change on attribute named "state" that is an Enum.
>
> B receives a CDODeltaNotificationImpl with the change made on the attribute named "state". But there is a bug here,
> indeed both calling getOldObject / getNewObject returns an Integer instead of the Enum, I suppose it is due to the
> fact the Enum is transported over the networlk as integer.
>
> Thus if I cast the result of getOldObject or getNewObject in the expected Enum, I get a ClassCastException.
>
> I'm using CDO 4.3 release with Luna (Shipped in last June).
> Should I file a bugzilla ?
Sure. If you know how to fix it you ideally submit a review to Gerrit ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] ClassCastException in CDODeltaNotification for Enum-based attribute [message #1472448 is a reply to message #1471415] Thu, 13 November 2014 22:07 Go to previous message
Stephane  Fournier is currently offline Stephane FournierFriend
Messages: 299
Registered: July 2009
Senior Member
Unfortunately, I'm not aware of Gerrit.
I reproduced the bug with CD0 4.3 from Luna shipped in June.

I have open a bugzilla https://bugs.eclipse.org/bugs/show_bug.cgi?id=450880 and I will give you the fix tomorrow in the bugzilla.

The fix is based on EMF Reflective API to retrieve: from the EStructuralFeature that points to an EEnum, the EEnumLiteral matching the Integer value and from that the related Java Enum literal.

St├ęphane.
Previous Topic:Sharing a resource between transactional editing domains
Next Topic:[CDO] eIsSet is ko for eOpposite structural feature ?
Goto Forum:
  


Current Time: Tue May 21 22:58:55 GMT 2019

Powered by FUDForum. Page generated in 0.02158 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top