jescapo / gwteventservice

Automatically exported from code.google.com/p/gwteventservice
Other
0 stars 0 forks source link

Serialization/deserialzation of events with enums unreliable #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Hard to tell...can only comment on what we're seeing. 

What is the expected output? What do you see instead?
Implementations of Event that contain enum fields are not properly 
serialized/deserialized i.e. enum values received in GWT client were not the 
same as the ones sent from the server through 
RemoteEventServiceServlet.addEvent(Domain, Event). In one example we have an 
enum with (among others) the values HS_STOERUNG and NS_STOERUNG. Consistently, 
when the event on the server has enum value HS_STOERUNG we get NS_STOERUNG in 
the client.

What version of the product are you using? On what operating system?
Tested with 1.2.0 on both Unix & Windows (7 & 2008 Server).

Please provide any additional information below.
Where is the code that serializes/deserializes events? We might be able to 
provide a patch.

Original issue reported on code.google.com by marcel@frightanic.com on 5 Oct 2012 at 12:53

GoogleCodeExporter commented 9 years ago
When you use the default connection strategy, the events are serialized and 
deserialized automatically by GWT-RPC.

One reason could be that your enum class wasn't recompiled by the GWT compiler. 
The enum has also to be serializable and has to fulfill the requirements to a 
serializable class. For example it has to provide a no-arg constructor and the 
holding member variable has not to be declared as 'final'. Could you please 
verify if these requirements are fulfilled?

I have just tested it with a quick and dirty modification to the demo 
application HelloGWTEventService and it is working fine (see the attached 
patch).

Original comment by sven.strohschein@googlemail.com on 24 Nov 2012 at 2:59

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for your feedback and for trying to reproduce this.
The reason can't be that the enum wasn't /re/compiled as we did a number 
clean-rebuild attempts. It still suspect that this bug is with 
serialized/deserialized values. I understand this must be a GWT error then.
We have several dozen enums throughout the application and it's only those two 
particular values of one particular enum that cause problems. They are a small 
subset of an enum that has a lot more values, but only those two fail.

-> I guess you can close this

Original comment by marcel@frightanic.com on 25 Nov 2012 at 12:40

GoogleCodeExporter commented 9 years ago
Hm, than is strange, but I think it is a GWT bug, so I mark this issue as 
invalid.

Maybe you can find the problem, by activating streaming and setting a debug 
breakpoint in 
de.novanic.eventservice.service.connection.strategy.connector.streaming.Streamin
gServerConnector#serialize(DomainEvent). At this point the GWT serialization 
logic is called manually, because the streaming server connector doesn't use 
the standard GWT-RPC connection and therefore you can see the serialized String 
at this method.

Original comment by sven.strohschein@googlemail.com on 25 Nov 2012 at 1:44

GoogleCodeExporter commented 9 years ago
I have a similar issue as documented in 
http://code.google.com/p/google-web-toolkit/issues/detail?id=7836.

The issue arises when changes are made to the enum, but for whatever reason, 
gwt still uses the old enum on the client side.
Again, gwt seems to be compiling the old enum prior to the edit.
Either that, or the compiler is serializing the enum based on the old index.

Original comment by flexr...@gmail.com on 10 Dec 2012 at 5:40