abhisheksharma85 / gwtprojsonserializer

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

Manage missing json values about "pojo" field on Deserialization #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a pojo with at least one pojo field (not only primitive fields)
2. Create a related json string without json value about that pojo field.
3. Deserialize.

What is the expected output? What do you see instead?
I need the ability to parse json string that doesn't have some value about the 
pojo. 
With primitive field, there's no problem, DeserializerHelper manage that:
if (value == null || value instanceof JSONNull) {
  return null;
}
but when the json value is about another pojo I get a 
IncompatibleObjectException.

What version of the product are you using? On what operating system?
v 1.0.2 on Mac OSX

Please provide any additional information below.
The problem is about no check in generated deserialization "deSerialize" method 
for pojos. I reach my goal adding a check in the first row of the method about 
null jsonValue:

if(jsonValue == null || jsonValue instanceof JSONNull){
  return null;
}

Hope that it will be helpful.

Original issue reported on code.google.com by aggs...@gmail.com on 23 Oct 2010 at 10:29

GoogleCodeExporter commented 8 years ago
Hello

If you've dug a bit into the code, can you provide a patch?

Thanks

Original comment by goo...@alishomepage.com on 31 Oct 2010 at 1:09

GoogleCodeExporter commented 8 years ago

Original comment by goo...@alishomepage.com on 27 Mar 2011 at 3:56