Open GoogleCodeExporter opened 9 years ago
We should go even further. Every error message should include a full path in
the object model. Like "customers[3].homeAddress.street[0]" or similar. It
wouldn't be too much work to include this state in JsonReader.
Original comment by limpbizkit
on 29 Dec 2011 at 5:28
Issue 160 has been merged into this issue.
Original comment by limpbizkit
on 29 Dec 2011 at 6:03
Issue 335 has been merged into this issue.
Original comment by limpbizkit
on 29 Dec 2011 at 7:29
Can I contribute with this enhancements to the project?
Original comment by Jayrmo...@gmail.com
on 29 Dec 2011 at 11:16
Jaymotta: Would be great if you can post some source-code that outlines
suggestions on how to do this.
Original comment by inder123
on 31 Dec 2011 at 9:53
http://paste.ideaslabs.com/show/0FJICsG4xc
Original comment by Jayrmo...@gmail.com
on 6 Jan 2012 at 12:01
We want this at Square.
Original comment by limpbizkit
on 21 Sep 2012 at 8:39
Would have been very helpful for this crash:
ConcurrentModificationException
at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:569)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:95)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:60)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:96)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:60)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)
at com.google.gson.Gson.toJson(Gson.java:586)
at com.google.gson.Gson.toJson(Gson.java:565)
at com.google.gson.Gson.toJson(Gson.java:520)
at com.google.gson.Gson.toJson(Gson.java:500)
Original comment by limpbizkit
on 12 Nov 2012 at 12:13
Issue 476 has been merged into this issue.
Original comment by limpbizkit
on 4 Feb 2013 at 3:31
As a work around, is it possible to get GSON to log its traversal of the object
tree as it generates JSON? I just had to debug a circular reference buried
within in a large object model and the only way I could find the problem was by
attaching a debugger, which was very inconvenient in my case.
Original comment by ja...@planticle.com.au
on 15 Jul 2013 at 5:34
I think we should do this, and we should use JsonPath to pinpoint the location
in the document of the failure:
"Expected a boolean but was NUMBER at line 1 column 37:
$.payments[2].customers[1].has_email_preference"
Original comment by limpbizkit
on 26 Mar 2014 at 6:05
http://code.google.com/p/google-gson/source/detail?r=1286
Original comment by jwil...@squareup.com
on 31 Jul 2014 at 5:20
Hi,
I've tried the SVN HEAD version (r1288) and the issue is still present.
In my case the exception is thrown from JsonTreeReader.java without any
information about object-model location.
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected
BEGIN_ARRAY but was STRING
at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(Reflecti
veTypeAdapterFactory.java:183)
at
com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRunt
imeTypeWrapper.java:40)
at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72)
at
com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRunt
imeTypeWrapper.java:40)
at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72)
at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveType
AdapterFactory.java:93)
at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(Reflecti
veTypeAdapterFactory.java:179)
at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveType
AdapterFactory.java:93)
at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(Reflecti
veTypeAdapterFactory.java:179)
at com.google.gson.Gson.fromJson(Gson.java:805)
at com.google.gson.Gson.fromJson(Gson.java:870)
at com.google.gson.Gson.fromJson(Gson.java:843)
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING
at com.google.gson.internal.bind.JsonTreeReader.expect(JsonTreeReader.java:139)
at
com.google.gson.internal.bind.JsonTreeReader.beginArray(JsonTreeReader.java:58)
at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:70)
at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveType
AdapterFactory.java:93)
at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(Reflecti
veTypeAdapterFactory.java:179)
... 26 more
Best regards,
Alex
Original comment by zilberk...@gmail.com
on 3 Aug 2014 at 2:26
Yup, Alex you're right. This is only implemented for stream-backed JsonReader.
I still need to make it work for the JsonElement-backed version.
Original comment by limpbizkit
on 3 Aug 2014 at 3:05
Original issue reported on code.google.com by
Jayrmo...@gmail.com
on 28 Dec 2011 at 9:11