You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
I'm developing an GitHub application with AndroidAnnotations. This application isn't very complex and all works fine except when I don't have a good wireless connection on my smartphone.
With this bad connection, I receive a force closed exception with a online request. After that, I won't be able to succeed this request again. I restart the application but the exception come back.
I'm using the GitHub API v3. So, there aren't problems with the JSON.
The stack trace is :
01-14 22:35:16.082: E/AndroidRuntime(9317): FATAL EXCEPTION: pool-1-thread-101-14 22:35:16.082: E/AndroidRuntime(9317): Process: fr.univ.lille1.github, PID: 931701-14 22:35:16.082: E/AndroidRuntime(9317): org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 13; nested exception is com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1301-14 22:35:16.082: E/AndroidRuntime(9317): at org.springframework.http.converter.json.GsonHttpMessageConverter.readInternal(GsonHttpMessageConverter.java:143)01-14 22:35:16.082: E/AndroidRuntime(9317): at org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:147)01-14 22:35:16.082: E/AndroidRuntime(9317): at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:76)01-14 22:35:16.082: E/AndroidRuntime(9317): at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:655)01-14 22:35:16.082: E/AndroidRuntime(9317): at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:641)01-14 22:35:16.082: E/AndroidRuntime(9317): at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:484)01-14 22:35:16.082: E/AndroidRuntime(9317): at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:447)01-14 22:35:16.082: E/AndroidRuntime(9317): at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:422)01-14 22:35:16.082: E/AndroidRuntime(9317): at fr.univ.lille1.github.network.RestGithub_.getFollowings(RestGithub_.java:55)01-14 22:35:16.082: E/AndroidRuntime(9317): at fr.univ.lille1.github.FollowingActivity.backgroundRepository(FollowingActivity.java:36)01-14 22:35:16.082: E/AndroidRuntime(9317): at fr.univ.lille1.github.FollowingActivity_.access$101(FollowingActivity_.java:27)01-14 22:35:16.082: E/AndroidRuntime(9317): at fr.univ.lille1.github.FollowingActivity_$3.execute(FollowingActivity_.java:130)01-14 22:35:16.082: E/AndroidRuntime(9317): at org.androidannotations.api.BackgroundExecutor$Task.run(BackgroundExecutor.java:302)01-14 22:35:16.082: E/AndroidRuntime(9317): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)01-14 22:35:16.082: E/AndroidRuntime(9317): at java.util.concurrent.FutureTask.run(FutureTask.java:237)01-14 22:35:16.082: E/AndroidRuntime(9317): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)01-14 22:35:16.082: E/AndroidRuntime(9317): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)01-14 22:35:16.082: E/AndroidRuntime(9317): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)01-14 22:35:16.082: E/AndroidRuntime(9317): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)01-14 22:35:16.082: E/AndroidRuntime(9317): at java.lang.Thread.run(Thread.java:841)01-14 22:35:16.082: E/AndroidRuntime(9317): Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1301-14 22:35:16.082: E/AndroidRuntime(9317): at com.google.gson.Gson.fromJson(Gson.java:806)01-14 22:35:16.082: E/AndroidRuntime(9317): at com.google.gson.Gson.fromJson(Gson.java:734)01-14 22:35:16.082: E/AndroidRuntime(9317): at org.springframework.http.converter.json.GsonHttpMessageConverter.readInternal(GsonHttpMessageConverter.java:140)01-14 22:35:16.082: E/AndroidRuntime(9317): ... 19 more01-14 22:35:16.082: E/AndroidRuntime(9317): Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1301-14 22:35:16.082: E/AndroidRuntime(9317): at com.google.gson.stream.JsonReader.expect(JsonReader.java:339)01-14 22:35:16.082: E/AndroidRuntime(9317): at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:306)01-14 22:35:16.082: E/AndroidRuntime(9317): at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:79)01-14 22:35:16.082: E/AndroidRuntime(9317): at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60)01-14 22:35:16.082: E/AndroidRuntime(9317): at com.google.gson.Gson.fromJson(Gson.java:795)01-14 22:35:16.082: E/AndroidRuntime(9317): ... 21 more
Anyway, if the data is wrong AA should provide a graceful fallback - some
way to handle this situation, what do you think?
15.01.2014 1:45 ÐÏÌØÚÏ×ÁÔÅÌØ "Gerard" notifications@github.com ÎÁÐÉÓÁÌ:
Yes, I thought that too but I can launch my online request without
problems when I have a good connection.
Reply to this email directly or view it on GitHubhttps://github.com//issues/888#issuecomment-32310779
.
@Artyomcool > There is already a workaround for this since AA 3.0. Unfortunately it's partly buggy... But it will work
Each rest methods implementation try to propagate the exception to a RestErrorHandler. So, the Rest interface just have to extends RestClientErrorHandling to be able to set this RestErrorHandler. Look at the generated code for this.
Also, it seems I forgot to explain this point in the wiki.
@GerardPaligot > This is weird because in case of bad connection, RestTemplate will eventually throw a IOException: Connection reset by peer and the converter will not try to deserialize the content. You best shot is to launch your app in debug and see what's going on.
Hello,
I'm developing an GitHub application with AndroidAnnotations. This application isn't very complex and all works fine except when I don't have a good wireless connection on my smartphone.
With this bad connection, I receive a force closed exception with a online request. After that, I won't be able to succeed this request again. I restart the application but the exception come back.
I'm using the GitHub API v3. So, there aren't problems with the JSON.
The stack trace is :