minh93 / google-gson

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

Patch for /trunk/extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java #614

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Inserted nullcheck for value, so null fields will not crash at line 217 
(value.getClass()) when writing to json.

Original issue reported on code.google.com by oliver.k...@gmail.com on 30 Nov 2014 at 8:49

Attachments:

GoogleCodeExporter commented 9 years ago
for reference: Another crash happens when reading null.
directly in 
com.google.gson.typeadapters.RuntimeTypeAdapterFactory.create(...).new 
TypeAdapter() {...}.read(JsonReader)

after JsonElement jsonElement = Streams.parse(in); add
if(jsonElement.isJsonNull()) { return null; }.
I would have submitted another patch but a strange HTTP400 error got in the way.

Original comment by oliver.k...@gmail.com on 30 Nov 2014 at 9:51