samujjwal / google-gson

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

Gson produces StackOverflow on PrintStream objects #603

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Gson gson = new Gson();
gson.toJson(new System.out);

It seems to fail with any PrintStream, but above is the simplest example. In my 
case, System.out was the value of a field in an object I was deserializing.

What is the expected output? What do you see instead?
I would probably just expect the simple name of the class (not sure what else 
to expect on a PrintStream).

The output I get instead is a StackOverflow error identical, as far as I can 
tell, to this issue:
https://code.google.com/p/google-gson/issues/detail?id=440

What version of the product are you using? On what operating system?
Gson 2.2.2 on Red Hat 5 or Mac OS 10.9

Please provide any additional information below.
This may be the same problem as the issue linked above, but I can't tell if 
they're the same root cause and have the same resolution or not. I don't have 
the means to test with a downgraded version of Gson at work or at home now.

Thanks.

Original issue reported on code.google.com by kylewenh...@gmail.com on 27 Oct 2014 at 3:48