What does this error mean? java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference

102 views
Skip to first unread message

Jeffrey Nicholas

unread,
Apr 27, 2020, 10:14:15 PM4/27/20
to google-gson
When I execute the serialization code locally it works fine, however for my production users they see this exception.

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
at libcore.reflect.TypeVariableImpl.hashCode(TypeVariableImpl.java:47)
at com.google.gson.reflect.TypeToken.<init>(TypeToken.java:25)
at com.google.gson.reflect.TypeToken.get(TypeToken.java:2)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:22)
at com.google.gson.Gson.getAdapter(Gson.java:74)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:42)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:120)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:22)
at com.google.gson.Gson.getAdapter(Gson.java:74)
at com.google.gson.Gson.toJson(Gson.java:4)
at com.google.gson.Gson.toJson(Gson.java:8)
at com.google.gson.Gson.toJson(Gson.java:5)
at com.google.gson.Gson.toJson(Gson.java:13)
Reply all
Reply to author
Forward
0 new messages