danshannon / javastravav3api

Strava API v3 implementation written in Java v8
http://danshannon.github.io/javastravav3api/
81 stars 44 forks source link

NumberFormatException caused by int overflow #180

Open ssferrazza opened 7 years ago

ssferrazza commented 7 years ago

Hi,

I'm still getting a NumberFormatException. I guess the activityId should be a long not an int.

Cheers -Sal

Caused by: retrofit.RetrofitError: com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 2277625665 at line 1 column 11061 path $.best_efforts[0].id
    at retrofit.RetrofitError.conversionError(RetrofitError.java:33)
    at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:383)
    at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
    ... 12 more
Caused by: retrofit.converter.ConversionException: com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 2277625665 at line 1 column 11061 path $.best_efforts[0].id
    at retrofit.converter.GsonConverter.fromBody(GsonConverter.java:67)
    at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:367)
    ... 13 more
Caused by: com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 2277625665 at line 1 column 11061 path $.best_efforts[0].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 com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
    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 com.google.gson.Gson.fromJson(Gson.java:887)
    at com.google.gson.Gson.fromJson(Gson.java:852)
    at retrofit.converter.GsonConverter.fromBody(GsonConverter.java:63)
    ... 14 more
Caused by: java.lang.NumberFormatException: Expected an int but was 2277625665 at line 1 column 11061 path $.best_efforts[0].id
    at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1164)
    at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:243)
    ... 25 more
danshannon commented 7 years ago

Hi Sal

Is that in 2.0.0-alpha or another version?

I'll take a look hopefully tonight

Cheers

Dan

Sent from my iPhone

On 13 Jun 2017, at 7:17 am, Sal notifications@github.com wrote:

Hi,

I'm still getting a NumberFormatException. I guess the activityId should be a long not an int.

Cheers -Sal

Caused by: retrofit.RetrofitError: com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 2277625665 at line 1 column 11061 path $.best_efforts[0].id at retrofit.RetrofitError.conversionError(RetrofitError.java:33) at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:383) at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240) ... 12 more Caused by: retrofit.converter.ConversionException: com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 2277625665 at line 1 column 11061 path $.best_efforts[0].id at retrofit.converter.GsonConverter.fromBody(GsonConverter.java:67) at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:367) ... 13 more Caused by: com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 2277625665 at line 1 column 11061 path $.best_efforts[0].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 com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61) 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 com.google.gson.Gson.fromJson(Gson.java:887) at com.google.gson.Gson.fromJson(Gson.java:852) at retrofit.converter.GsonConverter.fromBody(GsonConverter.java:63) ... 14 more Caused by: java.lang.NumberFormatException: Expected an int but was 2277625665 at line 1 column 11061 path $.best_efforts[0].id at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1164) at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:243) ... 25 more — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

ssferrazza commented 7 years ago

Hi Dan,

Thank you for your answer. Yes, currently it's in the 2.0.0-alpha, but also a similar Exception occurs in 1.0.3. Let me know if you need assistance.

Cheers -Sal

danshannon commented 7 years ago

Thanks Sal

If you have a good idea of the fix it would really help if you could submit a pull request for it. I won't get to it until late this week at the earliest at this stage - too many work commitments

Let me know if you can do

Cheers

Dan

Sent from my iPhone

On 13 Jun 2017, at 6:10 pm, Sal notifications@github.com wrote:

Hi Dan,

Thank you for your answer. Yes, currently it's in the 2.0.0-alpha, but also a similar Exception in 1.0.3. Let me know if you need assistance.

Cheers -Sal

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

hobovsky commented 7 years ago

Just logged in to report this issue :) Error I get is: 17:43:32.186 [http-bio-8080-exec-2] ERROR javastrava.api.v3.rest.util.RetrofitErrorHandler - StravaResponse [message=com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 2269799552 at line 1 column 5238 path $.best_efforts[0].id, errors=null]

I believe that the problem is StravaBestRunningEffort.id being mapped as Integer and not Long.

danshannon commented 7 years ago

Thank you!

Sent from my iPhone

On 16 Jun 2017, at 1:57 am, hobovsky notifications@github.com wrote:

Just logged in to report this issue :) Error I get is: 17:43:32.186 [http-bio-8080-exec-2] ERROR javastrava.api.v3.rest.util.RetrofitErrorHandler - StravaResponse [message=com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 2269799552 at line 1 column 5238 path $.best_efforts[0].id, errors=null]

I believe that the problem is StravaBestRunningEffort.id being mapped as Integer and not Long.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

danshannon commented 7 years ago

Fixed - changed StravaBestRunningEffort.id to Long rather than Integer

Having some cert issues but should be in a 2.0.0-alpha2 release shortly

orogerio commented 7 years ago

Hi Dan, do you know when 2.0.0-alpha2 will be released? Thanks for the great API.

ERROR javastrava.api.v3.rest.util.RetrofitErrorHandler - StravaResponse [message=com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 2390167247 at line 1 column 10685 path $.best_efforts[0].id, errors=null]

akoprow commented 5 years ago

I'm also bitten by this; any chance for that release please?

Vishal3010 commented 5 years ago

Any one can give me solution of this? when i type wrong password during login then this type of something occur Java.lang.NumberFormatException:Expected an int but was 630.053999999973624653..