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: 340
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: 6682
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: 340
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: Fri Apr 26 18:35:07 GMT 2024

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

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

Back to the top