tumblr / jumblr

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

java.lang.IllegalStateException: Expected NUMBER but was BOOLEAN #75

Open luisfo opened 8 years ago

luisfo commented 8 years ago

I have got this exception with this simple code:

JumblrClient jClient = ...
Post post = jClient.blogPost("gregorymosby", 110521489824L);

Output:

Exception in thread "main" 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.Gson.fromJson(Gson.java:795)
    at com.google.gson.Gson.fromJson(Gson.java:859)
    at com.google.gson.Gson$2.deserialize(Gson.java:131)
    at com.tumblr.jumblr.responses.PostDeserializer.deserialize(PostDeserializer.java:22)
    at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58)
    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:795)
    at com.google.gson.Gson.fromJson(Gson.java:859)
    at com.tumblr.jumblr.responses.ResponseWrapper.getPosts(ResponseWrapper.java:45)
    at com.tumblr.jumblr.JumblrClient.blogPosts(JumblrClient.java:189)
    at com.tumblr.jumblr.JumblrClient.blogPost(JumblrClient.java:205)

Checking manually the JSON, I have noticed that there is something wrong with the retrieved JSON of that post:

"thumbnail_width":false "thumbnail_height":false

where a 'numeric' (int/long) is expected.

luisfo commented 8 years ago

I've just found a similar problem here: https://github.com/tumblr/jumblr/issues/36 The same solution might be aplied.