Skip to content
This repository has been archived by the owner on Oct 7, 2019. It is now read-only.

Abandon Integer-s to avoid JSON exception #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Abandon Integer-s to avoid JSON exception #27

wants to merge 1 commit into from

Conversation

Sublimis
Copy link

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?

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant