SweetzpotAS / StravaZpot-Android

A fluent API to integrate with Strava on Android apps
70 stars 36 forks source link

Abandon Integer-s to avoid JSON exception #27

Open Sublimis opened 5 years ago

Sublimis commented 5 years ago

Getting

com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 2242280993 at line 1 column 17 path $.id
        at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:245)
        at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:235)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
        at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:37)
        at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:25)
        at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:117)
        at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:211)
        at retrofit2.OkHttpCall.execute(OkHttpCall.java:174)
        at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall.execute(ExecutorCallAdapterFactory.java:89)
        at com.sweetzpot.stravazpot.common.api.StravaAPI.execute(StravaAPI.java:26)
        at com.sweetzpot.stravazpot.upload.request.UploadFileRequest.execute(UploadFileRequest.java:91)

when uploading activity to Strava, as activityID 2242280993 is greater than Integer.MAX_VALUE in Java.

Longs should be used instead of Integers to avoid this problem?