mlieshoff/jcrapi

Crash when there's only one war day.

Closed this issue · 1 comments

I think this happens when there's only one day in the war log and the CR-API responds with just the war day instead of an array with only one day.

It occurred on this clan https://royaleapi.com/clan/9GRU8PJ0/war/analytics

eu.rtsketo.sakurastats D/Cought: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
        at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:338)
        at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:79)
        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:768)
        at com.google.gson.Gson.fromJson(Gson.java:717)
        at jcrapi.Client.getClanWarLog(Client.java:366)
        at jcrapi.Api.getClanWarLog(Api.java:310)
        at eu.rtsketo.sakurastats.APIControl$7.call(APIControl.java:356)
        at eu.rtsketo.sakurastats.APIControl$7.call(APIControl.java:354)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)