tumblr / jumblr

Tumblr API v2 Java Client
Apache License 2.0
278 stars 105 forks source link

Error when retrieve a blog's followers #36

Closed phathvu closed 10 years ago

phathvu commented 10 years ago

I tried to retrieve a blog's followers via this guideline : https://api.tumblr.com/console//calls/blog/followers

But, errors occurred : Caught: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected NUMBER but was BOOLEAN com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected NUMBER but was BOOLEAN at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60) at com.google.gson.Gson.fromJson(Gson.java:803) at com.google.gson.Gson.fromJson(Gson.java:868) at com.tumblr.jumblr.responses.ResponseWrapper.getUsers(ResponseWrapper.java:54) at com.tumblr.jumblr.JumblrClient.blogFollowers(JumblrClient.java:127) at com.tumblr.jumblr.JumblrClient.blogFollowers(JumblrClient.java:130) at com.tumblr.jumblr.JumblrClient$blogFollowers$0.call(Unknown Source) at aa.infomio.social.PhatTest.run(PhatTest.groovy:59) Caused by: java.lang.IllegalStateException: Expected NUMBER but was BOOLEAN at com.google.gson.internal.bind.JsonTreeReader.nextInt(JsonTreeReader.java:195) at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:239) at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:231) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172)

seejohnrun commented 10 years ago

Heya - the issue here is that the User object is used for both the /user/info call and the /users calls. Normally this wouldn't be a problem, but it is because on the info call, following is a count of followings, and on the individual users it's a boolean indicating following or not. I'll take a look here and see what I can do. Thanks for the report!