Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE calling toJson() with a null UUID field #369

Closed
GoogleCodeExporter opened this issue Mar 19, 2015 · 2 comments
Closed

NPE calling toJson() with a null UUID field #369

GoogleCodeExporter opened this issue Mar 19, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

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

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision r993.

Original comment by limpbizkit on 14 Oct 2011 at 3:17

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Thanks for the perfect bug report. Fixed!

Original comment by limpbizkit on 14 Oct 2011 at 3:17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant