What steps will reproduce the problem?
public class TestToJsonObject
{
private UUID u1 = null;
public TestToJsonObject() {}
}
Gson gson = new GsonBuilder().create();
TestToJsonObject o = new TestToJsonObject();
System.out.println(gson.toJson(o));
What is the expected output? What do you see instead?
I would expect to see no output. Instead I get the following NPE:
java.lang.NullPointerException
at com.google.gson.internal.bind.TypeAdapters$17.write(TypeAdapters.java:411)
at com.google.gson.internal.bind.TypeAdapters$17.write(TypeAdapters.java:400)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:66)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:194)
at com.google.gson.Gson.toJson(Gson.java:510)
at com.google.gson.Gson.toJson(Gson.java:489)
at com.google.gson.Gson.toJson(Gson.java:444)
at com.google.gson.Gson.toJson(Gson.java:424)
What version of the product are you using? On what operating system?
r992
Please provide any additional information below.
Original issue reported on code.google.com by chris.p....@gmail.com on 13 Oct 2011 at 5:59
Original issue reported on code.google.com by
chris.p....@gmail.com
on 13 Oct 2011 at 5:59