Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Exception Parsing Message ID #119

Closed
jokersplusone opened this issue Jun 22, 2020 · 5 comments
Closed

Uncaught Exception Parsing Message ID #119

jokersplusone opened this issue Jun 22, 2020 · 5 comments
Labels
a:bug Something isn't working

Comments

@jokersplusone
Copy link

The code is trying to convert message id to an int and throwing an exception when the id is too large, ie: 202002161000040. Once this occurs it's unable to load any other messages from the server until the culprit message is deleted.
That event id above was either generated by Watchtower or Lidarr, but I expect other apps to fall into the same trap

java.lang.RuntimeException: An error occurred while executing doInBackground()
	at android.os.AsyncTask$4.done(AsyncTask.java:399)
	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
	at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
	at java.util.concurrent.FutureTask.run(FutureTask.java:271)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
	at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:929)
Caused by: com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 202002161000040 at line 1 column 164 path $.messages[0].id
	at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:228)
	at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:218)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
	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:131)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
	at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:39)
	at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
	at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:223)
	at retrofit2.OkHttpCall.execute(OkHttpCall.java:186)
	at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall.execute(ExecutorCallAdapterFactory.java:92)
	at com.github.gotify.api.Api.execute(Api.java:10)
	at com.github.gotify.messages.provider.MessageRequester.loadMore(MessageRequester.java:23)
	at com.github.gotify.messages.provider.MessageFacade.loadMore(MessageFacade.java:34)
	at com.github.gotify.messages.provider.MessageFacade.loadMoreIfNotPresent(MessageFacade.java:43)
	at com.github.gotify.messages.MessagesActivity$SelectApplicationAndUpdateMessages.doInBackground(MessagesActivity.java:606)
	at com.github.gotify.messages.MessagesActivity$SelectApplicationAndUpdateMessages.doInBackground(MessagesActivity.java:595)
	at android.os.AsyncTask$3.call(AsyncTask.java:378)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	... 5 more
Caused by: java.lang.NumberFormatException: Expected an int but was 202002161000040 at line 1 column 164 path $.messages[0].id
	at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1173)
	at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:226)
	... 26 more
@jokersplusone
Copy link
Author

Client Ver Android: 2.0.12
Server: 2.0.16

@jmattheis
Copy link
Member

jmattheis commented Jun 23, 2020

there are actually two bugs:

  1. the id is settable via the api
  2. the server uses uint for the message id and the android app uses integer.

@jokersplusone
Copy link
Author

Thanks.

You might want to tighten the client code so that if it blows up parsing a message it's still recoverable. As it is right now the Android client will not show any new messages until the message is deleted using the web browser.

@jmattheis
Copy link
Member

That's the plan.

@jmattheis
Copy link
Member

Should be fixed with the latest version of gotify/server & gotify/android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug Something isn't working
Development

No branches or pull requests

2 participants