discomarathon / google-gson

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

Include a default serializer for exceptions #90

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Extend Exception and call the no-arg constructor
2.
3.

What is the expected output? What do you see instead?
You should get deserialized json data.

Rather, a ciruclar reference is detected and the object cannot be
deserialized to json. However, if you explicitly call the 2-arg constructor
with (null, null), it will deserialize to json correctly.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by davids...@google.com on 9 Jan 2009 at 6:59

GoogleCodeExporter commented 9 years ago
A related discussion is here:
http://groups.google.com/group/google-gson/browse_thread/thread/6b6dc35deef5ba78

Original comment by joel.leitch@gmail.com on 9 Jan 2009 at 7:35

GoogleCodeExporter commented 9 years ago
Deferred for a future release.

Original comment by inder123 on 29 Sep 2009 at 8:59

GoogleCodeExporter commented 9 years ago

Original comment by inder123 on 3 Nov 2010 at 12:01

GoogleCodeExporter commented 9 years ago
The underlying problem is that exceptions default to being caused by 'this'. 
You can work-around this by writing a custom serializer & deserializer for 
exceptions.

(If we fix issue 164, you'll only have to register "Throwable" for this to work 
for most exceptions)

Original comment by limpbizkit on 4 Nov 2010 at 10:40

GoogleCodeExporter commented 9 years ago
registerTypeHierarchyAdapter() makes this relatively easy. We won't support 
this in the framework.

Original comment by limpbizkit on 30 Dec 2011 at 6:42