Closed GoogleCodeExporter closed 8 years ago
I got the same problem with the same setup, GWT 2.0.3 and a simple class to
serialize.
Original comment by durin_mu...@hotmail.com
on 8 Jun 2010 at 7:29
I am getting the same problem, using GWT 2.0.3, attempting to serialize a
simple class
Original comment by dcott...@gmail.com
on 16 Jun 2010 at 6:56
changing getTypeName in Serializer.java to:
static protected String getTypeName( Object obj ){
String typeName = obj.getClass().getName();
return typeName;
}
resolves the problem
Original comment by stefan.l...@gmail.com
on 18 Jun 2010 at 5:38
Got the same problem, and did what was suggest above but still the same
problem.
The method getObjectSerializer( String name ) is returning nothing and thus the
serializer is null. The serializableTypes() method which is called inside
getObjectSerializer( String name ) is simply returning {}
I really need to fix this problem.
Original comment by ciaran.m...@gmail.com
on 18 Aug 2010 at 9:23
Hi,
I have made gwtprojsonserializer just with compilation of some other GWT json
serializers. I have also made it compatible with GWT 2.0+. If anyone has some
fixes and want to improve code please contact me to add you to project
contributors.
These informations are not enough to me to fix problem. Ciaran, could You send
me your domain model or send me just all your classes which implements my
com.kfuntak.gwt.json.serialization.client.JsonSerializable interface.
I use gwtprojsonserializer in all my GWT projects which contact services for
json response. It has some limitations and domain model must consider them.
Original comment by kfun...@gmail.com
on 18 Aug 2010 at 10:18
I had the same problem (with GWT 2.0.3 too). I debug through the code and I
agree with Stephan, there is a problem with getTypeName. Map SERIALIZABLE_TYPES
contains the full class name of the classes implementing JsonSerializable.
As you can see in getTypeName:
static protected String getTypeName( Object obj ){
String typeName = GWT.getTypeName( obj );
typeName = typeName.substring(typeName.lastIndexOf('.')+1);
return typeName.toLowerCase();
}
the full class name is stripped down to the lowercase class name.
I am not sure what is the reason for that.
kfuntak, I think you should be able to reproduce this by modify the unit in
SerializerTest.java as following:
[...]
University university = (University)serializer.deSerialize( jsonText,
"com.kfuntak.gwt.json.serialization.client.domain.University");
if (university != null) {
System.out.println(university.toString());
}
JSONValue jsonValue = serializer.serializeToJson( university );
[...]
If you deserialize to a class mypackage.MyClass, the error message will be:
Can't find object serializer for myclass
I modified and compiled the code. I attach the JAR to this comment.
kfuntak, if you give the permission, I can update the code on the repository.
Matthias
Original comment by matthias.buchner
on 25 Aug 2010 at 8:24
Attachments:
I fixed few more bugs. As I haven't the permissions to submit my changes, I
post a new version of the JAR here.
Original comment by matthias.buchner
on 2 Sep 2010 at 4:39
Attachments:
Here is a simple patch that solves the serialization problem (explained above)
(+ some list/collection (de)serialization issues, ie. don't throw exception
when field is missing in json,...).
...and a minor correction to SerializerTest.java (no need for toString()):
[...]
University university = (University)serializer.deSerialize(jsonText,
"com.kfuntak.gwt.json.serialization.client.domain.University");
if (university != null) {
System.out.println(serializer.serialize(university));
}
[...]
Sasa
Original comment by sasa...@gmail.com
on 1 Oct 2010 at 12:58
Attachments:
Original comment by remi.barraquand
on 17 Oct 2010 at 5:25
Original issue reported on code.google.com by
sridher....@gmail.com
on 24 May 2010 at 3:31